i need to restart my main activity from background Service.
I get the results of my service by a BroadcastReceiver and I need to resume it (after some operations).
Is it possible ?
How can i do this ?
I tried this solution Resume application and stack from notification but it doesn't work for me.
EDIT:
Thats my receiver:
private BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
if (bundle != null) {
int resultCode = bundle.getInt(DownloadService.RESULT);
if (resultCode == RESULT_OK) {
Log.i("MyApp", "RESULT OK");
final Intent mainIntent = new Intent(context, MainActivity.class);
mainIntent.setAction(Intent.ACTION_MAIN);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(mainIntent);
} else {
Toast.makeText(MainActivity.this, "KO",Toast.LENGTH_LONG).show();
}
}
}
};