Reputation: 12826
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:
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?
Upvotes: 0
Views: 1307
Reputation: 554
A Service should never start an Activity directly. This is clearly stated in the documentation on Notifications. You can view it at this link (please refer to the second paragraph).
The scenario that you described can be handled in an alternate way:
isValidated()
which returns true if
the user has already been validated.isValidated()
to first check whether the user is validated or
not. If not the Activity should show the from F.Upvotes: 1
Reputation: 26678
A Service is a Context, and a Context can start an Activity:
https://developer.android.com/reference/android/content/Context.html#startActivity(android.content.Intent)
Upvotes: 2