开发者

How to stop reminder in alarm

开发者 https://www.devze.com 2023-04-06 06:56 出处:网络
I have created the reminder in my application. but whenever i click the reminder button it starts playing continuously.but i want after some time stop the alarm(like after 10 or 20 secs). can you plea

I have created the reminder in my application. but whenever i click the reminder button it starts playing continuously.but i want after some time stop the alarm(like after 10 or 20 secs). can you please help me fo开发者_开发百科r this.

My Code section

 Calendar cal = Calendar.getInstance(); 
            cal.set(Calendar.MONTH, date.getMonth());
    cal.set(Calendar.YEAR, date.getYear());             
    cal.set(Calendar.DAY_OF_MONTH, date.getDay());
    cal.set(Calendar.HOUR_OF_DAY, date.getHours());
    cal.set(Calendar.MINUTE, date.getMinutes() + 5);


use this code to stop alarm. This code is used to cancel an alarm time.

AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
   alarmManager.cancel(pendingIntent);
0

精彩评论

暂无评论...
验证码 换一张
取 消