I’ve implemented a service that does an asynchronous sync between my application and google docs. I want to update the top level activity of my application when the sync is complete. However because of the service it’s possible that the app could be be in a unknown state. Is there a way to make the top level activity, whatever that may be, recreate itself from an asynchtask in a service.
I’ve implemented a service that does an asynchronous sync between my application and google
Share
In your Service, just call
startActivity(new Intent(this, TopLevelActivity.class)). This will launch your TopLevelActivity if it’s not already running, or call your TopLevelActivity’sonNewIntent()method if it is already running, and bring it to the top. You can overrideonNewIntent()and capture the Intent if you want to be notified.