I have a Service
that when one function gives to me true
it will start a new Activity
but it takes like 5 seconds...
I've read about this issue
, and I've found on StackOverflow
this example to "avoid" this bug..
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
try {
pendingIntent.send();
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
but sadly it doesn't start the Activity
faster, I don't need to be inmmediate (better if it's possible), but I don't want to wait +5 seconds to launch the new Activity
, do you knwo any trick to avoid this?
I'm using PendingIntent
because I've found that guy that said that it should solve this issue :
Starting an activity from a service after HOME button pressed without the 5 seconds delay
If I press back button
it launch it autommatically, 0 delay, but I'm looking pressing the home button
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With