In Android Can intents and broadcasts pass between user profiles - android

There seems to be limited documentation on this.
Im wondering if I have the same app installed in two different user profiles, and I fire an intent or broadcast applicable for that app, in one user profile, can the same app in the other user profile pick the broadcast or intent?
If so is this true for any android supported IPC such as binding etc...
Can anyone point me to good documentation on this?

The documentation you linked provides the information you need, implicitly though.
App. An application’s data exists within each associated user. App data is sandboxed from other applications within the same user. Apps within the same user can interact with each other via IPC. For details, refer to Building Apps for Work.
So you can't communicate with any app of another user.

Related

Sharing Data Between Android Apps By The Same Developer

We have a requirement to share some very simple data between Android apps, the data will basically just be a string but we want to ensure it's only shared between apps signed by us. The sharing of the data also needs to be programmatic i.e. without user interaction to initiate the sharing.
The issue we have with many of the data sharing methods we've found is that they imply the data is owned by one particular app which then makes it available to other apps. The data we need to share could be generated by any app so it doesn't have a natural owner.
Our ideal solution would be something similar to the Keychain on iOS where any app can write the data and any app can easily check if the data has already been written.
We have seen some solutions that involve setting a shared User ID for the apps but this appears to be deprecated in Android and also one of our apps is already in the store so the ID cannot now be changed.
Is anyone aware of any possible solutions on Android for this usecase?

Passing data between applications in Android

Illustration:
How do I pass data coming from a form in my app to a third-party app?
Also, what are the terms, functions and APIs about doing this?
It is possible through Intent and URI.
The app that is receiving your data should support be open to receive URI so that you can fire up the Intent method it will open the app and send data.
You can refer: https://developer.android.com/training/basics/intents/sending.html#java
Unfortunately there is not a one-size-fits-all solution to this question, as such you are going to receive a variety of different "solutions" but the truthful answer is, it depends on the implementation of the app built by the other party;
Intents
If the third-party app is open to receiving data through intents, and hopefully the developer of that app has documented this somewhere. This would be the most streamlined approach.
It is important to note with this implementation that if there are specific apps you have in mind to connect to, and your application is going to be publicly available, then the user will need to have those specific third-party apps installed. This is easier if you only have one specific third-party app in mind (you can check the user's device to see if it is installed and inform them), and gets exponentially more cumbersome for every additional application you wish to connect to, not only due to having to instruct the user about yet another required third-party app but also as you will need to make sure you are able to pass all the necessary data to a completely different application.
Have a look at this earlier question to see how this can be achieved.
APIs
Another solution would be to use APIs. Just like intents, this requires the third-party developer to have exposed their application to these specific API calls, which you can then connect to to pass your data. The simplest real-world implementation of this approach would be signing on to an application using a social media account instead of having to create a separate account per application.
This is less streamlined than the intents approach as it would involve additional steps of posting your data to the API and then opening the other app in order to retrieve the data and proceed.

How to embed a mobile application in other application?

I'm building a mobile application for a company and I need to add in the company mobile application a button that go directly in a different application .
Anyone know a solution to embed 1 mobile app in other app???
Inside the code of your button, you can launch an explicit/implicit intent that can launch another application (authored by someone else). The application won't be running inside your application, but to the user, he/she will have the illusion that the other application running is part of your own. This is assuming of course that the second application is already installed on the user's phone. If it isn't installed, your button can just fetch the relevant application's installation page from Google Play for the user to install the app, and then run the application once installed.
In your application, you can also provide a content provider to keep your data. A content provider provider exposes a set of public CRUD interfaces to your data for other applications to access. This is how the contacts database is shared on Android for instance between many different applications, even non-Google applications.
Basically, you first need start at the beginning and educate yourself on the fundamentals of Android. If you start reading about intents and content providers, those constructs may not make any sense to you until you first learn about Activities, the Activity's lifecycle, stacks/tasks, and the way security generally works on Android. You may even want to look on Youtube, there are some very good highly rated Google I/O videos on there that talk about the fundamental concepts of Android.

How to get a simple message from one of my other apps?

I have two separate APK's on Google Play. I'm planning a new version of each of them that has a new in-app purchase.
I want each of my two apps to be able to query the other one to see if the item was already purchased in the other app, so the user will not have to buy the item in both apps if they have both apps installed.
I have already released both apps and they do not have a shared ID, so I don't think that's an option, because I don't think you can change the sharedID on a published app. Also, it is possible that the user installs/uninstalls these apps in various orders, or downloads them on another device, so it is not adequate to simply make a Broadcast at the time of purchase.
Is there a way to query another app for a simple boolean response?
Is there a way to query another app for a simple boolean response?
I affraid not.
most close to it would be sharing preferences across packages, but its not officially supported, and I wouldn't count on it to work across all platforms.
or MODE_WORLD_READABLE preferences, but as mentioned in the answer - it's not secure, and it anyway deprecated in API 17.
only 3 ways supported with android API to communicate between different apps are:
Accessing ContentProvider
sending and receiving BroadcastReceiver
remote Service binding
I think that you can achieve easily your goal with any one of the three, although you right when you say that sending broadcast from one to another is not the safest way.
if I had to implement such feature - I would create a simple ContentProvider from one of the two apps, and access it from both apps to store and retrieve this shared information/data.
another good approach, would be doing some server side verification to get this information. of - course it limitations are that you need to have one, and you have your users to be connected to network for that..

What happens if two android apps register the same custom URI schema?

I'm no Android-Developer but I need to know what happens, if two applications register the same URI schema (e.g. by using an intent-filter).
Is that possible at all?
In iOS it is. Multiple apps can register for the same URI schema. It can not be predicted which app will be launched when that schema is called. To make things worse, the app that is launched "consumes the event". So no other app will be noticing anything.
Background of my question:
I'm working on a "secure" concept for the implicit flow in OAuth 2.0.
This flow includes a redirect (comming from the server) to a URI schema.
Unfortunately, I can't use a WebView in the app, because the app mustn't have any possibility to gain access to the users credentials.
Is that possible at all?
Yes, at least for activities. When something tries to start an activity matching the scheme (and rest of the <intent-filter>, the user will get a "chooser" window, showing all possible activities, from which the user can choose.

Categories

Resources