android 本机定时推送通知

时间:2018-08-26 13:21:42
【文件属性】:

文件名称:android 本机定时推送通知

文件大小:1.99MB

文件格式:RAR

更新时间:2018-08-26 13:21:42

定时推送通知

private void setReminder(boolean b) { // get the AlarmManager instance AlarmManager am= (AlarmManager) getSystemService(ALARM_SERVICE); // create a PendingIntent that will perform a broadcast PendingIntent pi= PendingIntent.getBroadcast(MainActivity.this, 0, new Intent(this,MyReceiver.class), 0); if(b){ // just use current time + 10s as the Alarm time. Calendar c=Calendar.getInstance(); c.setTimeInMillis(System.currentTimeMillis()); //可以根据项目要求修改,秒、分钟、提前、延后 c.add(Calendar.SECOND, 10); // schedule an alarm am.set(AlarmManager.RTC_WAKEUP, c.getTimeInMillis(),pi); } else{ // cancel current alarm am.cancel(pi); } }


【文件预览】:
本机定时推送通知Demo
----ReminderDemo()
--------bin()
--------res()
--------proguard-project.txt(781B)
--------ic_launcher-web.png(50KB)
--------assets()
--------gen()
--------.settings()
--------src()
--------.project(848B)
--------.classpath(475B)
--------project.properties(579B)
--------AndroidManifest.xml(1KB)
--------libs()

网友评论