views:

190

answers:

1

I have three separate applications A, B and C. All of them use service S. When A, B or C connect to service S and service S must start, it must gather credentials from the user using form F.

I want the user experience to go like this:

  1. From the Android main menu, the user taps one of the applications; A, B or C.
  2. Form F appears because the service has not been started.
  3. The user fills in form F and taps OK.
  4. Validation occurs.
  5. If validation of credentials is successful, then the appropriate Activity in the selected app (A, B or C) appears.
  6. After a successful validation, any subsequent applications that start do not need to authenticate, they'll just start with an Activity in that app.
  7. If the validation is unsuccessful and the user presses the back button, the main menu appears again.

Given all of this, what I believe I want is for the Service to start the credentials form when necessary -- can a Service do this? If not, what would be an alternative way to implement this?

+1  A: 

A Service is a Context, and a Context can start an Activity: http://developer.android.com/intl/de/reference/android/content/Context.html#startActivity(android.content.Intent)

synic