faby
faby

Reputation: 41

sending information and retrieving result between two different android apps

I would like to transfer information from one app to another entirely different app but I want to know if this is possible. For instance, I launch app A which asks users some questions about their location and if user gives the location between two different places then app A transfers that info to app B (app B could be like Google maps). Then app B uses the info from app A and shows the direction/route from the two given locations received from part A. After routing the location, app B (Google maps) is closed and then app B returns to app A. I know I can try to make a map in app A but since app B (Google maps) already performs well in terms of getting locations can I just call it?

can i use this concept for other apps that are on my phone?

Thanks for your response in advance :)

Upvotes: 1

Views: 115

Answers (3)

Felix
Felix

Reputation: 89576

As Roberto said, learn about intent filters. Then, you will realize that you can pass data from one app to another very easily. However, if you plan on doing this with a third party app (i.e. not made by you), you must first find out if that app supports such interaction with other apps (it might not expose any intent handlers).

For Google Maps, you can find the correct intents here. Simple example:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q=McDonalds")));

This snippet of code will launch the Maps application and perform a nearby search for, you guessed it, "McDonalds".

Upvotes: 0

Roberto C Serrano
Roberto C Serrano

Reputation: 121

Intents are the platform component that Android provides to be able to leverage individual Activities with-in different applications.

Intents are a core component in the android Architecture, and if understand your question well enough, they are what you are looking for.

Here is a lot more info: http://developer.android.com/guide/topics/intents/intents-filters.html

Upvotes: 2

Angrybambr
Angrybambr

Reputation: 220

So. You can use saving your data to the temporary file in the APP A, then open APP B -> read this file -> process this data -> delete temporary file. Does such variant acceptable for you?

Upvotes: 0

Related Questions