Passing data between applications in Android - 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.

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?

Google Authenticator - User Registration withOUT Mobile App

We are developing Native Mobile Application : Android platform, Ios Platform (Swift).
Instead of asking user to download and install https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en_IN mobile app and then generate a QR code in our application to be scanned by this app, we are willing to do it api way. Means We want to call Google Authenticator API pass it QR image, secret and user is registered
Is this Ok and possible. Any one using it please suggest.
I'm not going to say that this is impossible, but integrating Google Authenticator would be a nightmare, and likely wouldn't do what you're expecting it to do. Allow me to explain.
Problem #1
For each instance of the app, you'll have to have a Unique Identifier to pair it to Google's Authenticator. In other words, you'll need to generate a new QR code for each device, pass that off to the system (Which doesn't exist without the app.) to pair the application. This is going to require a "Log-In" to properly store.
Check out this for a possible work-around to Problem #1: https://authenticatorapi.com/
Problem #2
If you're already logging in and the device is already being authenticated, what purpose does the Google Authenticator provide? Well, I'm assuming it allows you to prevent unauthorized access, possibly prevent more than one device. There are infinitely easier ways to manage this, location services are the first one that comes to mind for me.
Possible Solution (iOS)
This is absolutely my go-to method for handling authentication. Encourage or require your users to use 2FA (Two Factor Authentication) attached to SMS messaging. A simple line of code such as this will grab an SMS one-time code.
// Available as of iOS 12, make sure to check version.
self.verifyCodeTextField.textContentType = .oneTimeCode
Android SMS Retrieval
Android Auto-SMS-Retrieval https://developers.google.com/identity/sms-retriever/overview
I don't know it all, most certainly, but I hope this opens the floor for some discussion and brings forth a solution or explanation to your question.
Research Material
Google Authenticator available as a public service?
java API for google Authenticator

In Android Can intents and broadcasts pass between user profiles

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.

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..

How to get the content of running applications in Android?

I want to make a application that has similar function as Android Beam, but the question is how to get the content of those running apps. For example, if the web browser, Youtube and Google Map is running, how do I get the web address, the video link and the location? Thank You.
You will only be able to get information like this if the running application provides it through some sort of global access method, e.g. a service or content provider. It is highly unlikely that any application will do this as it has some serious security/privacy implications.
You will only be able to develop such an application by writing a system application aka you'll need root permissions.
The best approach in my opinion will be that you look through the Android Beam source code, to see how it's done there. The official API will not help you here. Since the functions used in such system applications is not in the API there is no guarantee that it will work with future versions of Android, so be careful.
I doubt that this will be an easy task. If it's really similar to Android Beam, try building your code on top of the official source.
For Android Beam, the app itself is sharing the data. The NFC background service gets the data to be shared via Android Beam delivered to it by the app's Activities. An Activity either calls at the beginning (e.g. in onResume()) the method NfcAdapter.setNdefPushMessage() to share a static piece of data or it calls NfcAdapter.setNdefPushMessageCallback() to register a callback that will create the data to be shared at the moment Android Beam becomes active.
A number of the standard Android and Google apps have been extended to support this in Android 4.0 ICS, for example Browser, Gmail, Maps, People and Youtube. Apps that have no support for this, will by default share a link to the download page of that app in the Google Play store.

Categories

Resources