Android Alarm manager working, but delayed

前端 未结 2 1661
我在风中等你
我在风中等你 2020-12-29 10:22

I would like to make a delay(10 min) for user then after it, user can edit something.

to do this,I created a setAlarm function :

public         


        
2条回答
  •  我在风中等你
    2020-12-29 10:57

    The easiest way to make system have a delay and then sound an alarm at the exact specified time is using setExact(), and the code can be something like this.

    am.setExact(AlarmManager.RTC_WAKEUP,System.currentTimeMillis() + (time_you_want_to_delay_in_milliseconds) ,pi);
    

提交回复
热议问题