0

How to start an activity from service when user press home button. As mentioned in this feature that for 5 seconds the activity cannot be started: link

I want to start the activity when user taps on it.

Thanks!

Anoop M Maddasseri
  • 10,213
  • 3
  • 52
  • 73
Pranav Agrawal
  • 466
  • 6
  • 17
  • Possible duplicate of [Starting an activity from a service after HOME button pressed without the 5 seconds delay](https://stackoverflow.com/questions/5600084/starting-an-activity-from-a-service-after-home-button-pressed-without-the-5-seco) – Sam Oct 05 '17 at 06:44

1 Answers1

0

To run after a specified time, you can use the following code to do:

new CountDownTimer(5000, 1000){
@Override
public void onTick(long millisUntilFinished){}

@Override
public void onFinish(){

// Your code run after 5 second...


}
}.start();
mGol
  • 106
  • 1
  • 1
  • 9