I have a problem with a activity where
onStop breaks my
OAuth authentication process.
First a small explanation about the context of my app:
I have this activity (lets call it the
receiveSharedDataActivity) which handles incoming data which is being send from other apps. This activity is made using the following example from the Android Developer site: http://developer.android.com/training/sharing/receive.html.
My app requires the user to be logged in using a E-mail and a password or using the Facebook or Twitter OAuth login. It is possible that the user has never opened the app and thus is not logged in yet. (The possibility is small, but it can still occur.)
The problem (challenge):
So when the user decides to share some data to my app but is not logged in yet, I show him the 3 login options (E-mail, Facebook, and Twitter) in the
receiveSharedDataActivity using fragments. This way he can first authenticate himself and after that the data can be handled. When the user chooses to login with Facebook the Twitter OAuth login option he is redirected to a new activity from Facebook or Twitter where he needs to login and give my app permission to access his user data. All goes well up to this point. Because when the user is redirected to this new activity, the
receiveSharedDataActivity is automatically being stopped using onStop because it is no longer visible to the user. When the user then logs in at the Facebook or Twitter activity and is being send back to the
receiveSharedDataActivity, there is no
receiveSharedDataActivity anymore because it has stopped. So the user ends up at another app where the user decided to share data from.
How can I prevent the
receiveSharedDataActivity from being stopped when the user is login in at the Facebook or Twitter activity?
I am looking forward to your solutions because I am pretty stuck with this problem.