0

What is the best practice to deliver data from one app to another app?

Assuming APP "A" calls APP "B" to deliver some infos.

App "B" is startet and a user navigates through activities. Now the activity stack has 10 activities opend and the result for APP "A" is ready in activity 10 within app "B".

What is the best practice to close APP "B" with all open activities and return the result?

PKAP
  • 705
  • 8
  • 20
  • natively I didn't come across a nice solution yet maybe try Intent.FLAG_ACTIVITY_CLEAR_TASK to launche a new activity then close it. check this http://stackoverflow.com/questions/7075349/android-clear-activity-stack if you use eventbus? if yes I post an event to all activities to close and that is it , you can add it to the base activity if you have one. – Hala.M Oct 17 '16 at 15:41
  • eventbut is a interessting idea - however i dont think its the best practice recommended by google ;) using flags seems to me a little bit dirty aswell, and i dont think anyone is still using, but works only from api level 11? – PKAP Oct 17 '16 at 19:17
  • yes I know but again what is best practice for closing 10 activities at once I think if we need to really think about it I would reconstruct the whole app maybe even do it as one activity many fragment. or close each activity as u go and have the info save in a global class – Hala.M Oct 17 '16 at 22:36
  • 10 activies was just an example, to point out that there could be more than one open activity ;) – PKAP Oct 18 '16 at 07:04

1 Answers1

0

One option is through Intent s,

Here you can read more about.

Hope it helps!

jos
  • 1,070
  • 12
  • 22
  • the question is whats best practice - of course i can clsoe all open activites return the intent from one to another, but is this the way it is meant to be done? – PKAP Oct 17 '16 at 15:25
  • I think it depends about the data that you want to share and the UX that you design. I mean, if the user will change between the apps a lot maybe clear the stack is not a good option. In this case maybe ContentProviders can be a solution. I don't know if there will be a "standard" solution to all cases. I will be aware if there is :) – jos Oct 17 '16 at 16:06