I am having 4 different applications. One is a login and other three are apps that will go to login if not authorized. Login app should get the package name from the other apps. According to the name received, it should again relaunch the application. I've no idea how can I do it.
Asked
Active
Viewed 196 times
1
-
Did you mean four different activities? Actually android architecture goes that way: You can include login as an Activity. Did you really mean you wish to connect 4 apps? – Kailas Jun 11 '14 at 06:27
-
Firstly you need to install all these application to your device. and refer this :http://stackoverflow.com/questions/16683455/how-to-get-the-package-name-of-an-application-in-android-and-then-launch-that-ap – Krupa Patel Jun 11 '14 at 06:34
-
I meant it kailash :) – A_rmas Jun 17 '14 at 06:31
2 Answers
2
I think you need to do following stuff.
App1 :: Authenticate User
App2 :: any app
App3 :: any app
- Design Content Provider for Authorization of Apps. The content provider will be a component of App1.
- Other app will query Content Provider to know whether user of app2/app3 is authorized or not?
- If not then apps will fire an intent as a startActivityForResult for App1 to perform login action on behalf of other apps. We need to send user credentials, package name etc in intent.
- We need to define proper request and response codes for login action i.e in startActivityForResult.
- App1 will store user authentication data against each package(i.e app)
- Here main thing we need to take care of is when should App1 refresh it's user authentication data stored against each package.This mainly depends on your requirements.
You might need to add some more use cases as per you requirements.

Ashwin N Bhanushali
- 3,872
- 5
- 39
- 59
0
Finally I got to complete it as
1) create a file from every app that goes to login app. The file should contain the package name.
2) intent to login app.
3) authorize with login app and move to package as written in file.
Here I created 2 files one containing authorization i.e username and password and other containing package name.
The second file must be deleted and created every time before writing the package name.

A_rmas
- 784
- 2
- 10
- 26