There is no equivalent to startActivityForResult
in Service, so you have to roll your own.
First option:
You can use several standard Java tools for this, like Object.wait / Object.notify, that require a shared object reference.
For example, declare somewhere:
public static final Object sharedLock = new Object();
and in your service do:
startActivity(new Intent(this, GoogleAuthHelperActivity.class), FLAG_ACTIVITY_NEW_TASK);
synchronized (sharedLock) {
sharedLock.wait();
}
and in the activity:
// do something upon request and when finished:
synchronized (sharedLock) {
sharedLock.notify();
}
There are other more sophisticated classes for this in the java.util.concurrent package that you can use for this. Be careful though, that Services run on the same thread as the Activity, so if you are not starting a new Thread from the Service, then this will not work.
Another possible problem is if you cannot share an object reference between them two (because they run in different processes). Then you have to signal the finishing in some other way.
Second option:
You could split your Service code in two parts (before and after the activity). Run the activity and send a new intent to the Service when you are done. Upon receipt of this second Service, you continue with the second part.