android 通知显示时间,android:在特定时间显示通知?
我有一個名為的函數show_notification(),當用戶點擊按鈕時我會調用它.關鍵是,一旦他點擊[如下面的函數],我不想顯示通知,我想在特定的time= hours:mins
地方顯示此通知.小時和分鐘是兩個整數,具有我想要的時間值[例如小時= 22和分鐘= 40 ..意思是在22:40 [10:40 pm]發出此通知.順便說一句,這個警報應該每天同時重復.
public void show_notification() {
CharSequence notify_msg="Don't foget!";
CharSequence title= "you ve been notified by My app";
CharSequence details= "It works!";
NotificationManager nm= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notify= new Notification(android.R.drawable.stat_notify_more,
notify_msg,
System.currentTimeMillis());
Context mycontext= ActA.this;
Intent myintent= new Intent (mycontext, ActA.class);
PendingIntent pending= PendingIntent.getActivity(mycontext, 0, myintent, 0); ///0's are not applicable here
notify.setLatestEventInfo(mycontext, title, details, pending);
nm.notify(0, notify);
}
我希望你能詳細回答,因為我是一個非常新的開發者.
總結
以上是生活随笔為你收集整理的android 通知显示时间,android:在特定时间显示通知?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: android handler 主线程吗
- 下一篇: html 自动隐藏属性,隐藏(属性)