我正在代碼名爲1中開發應用程序。我試圖從應用程序發送用戶本地通知。當用戶打開應用程序時,我已按照以下方式安排LocalNotification
。android api中的Codenameone LocalNotification <16以及從最近刪除應用程序時
@Override
protected void beforeMain(Form f) {
Display.getInstance().cancelLocalNotification(notificationId);
LocalNotification notification = new LocalNotification();
notification.setId(notificationId);
notification.setAlertTitle("Haven't seen you in long time");
notification.setAlertBody("You have not visited us in long time. You are missing lots of good stuff");
Date date = new Date();
Display.getInstance().scheduleLocalNotification(notification, date.getTime()+threeMinute, LocalNotification.REPEAT_NONE);
}
這是我的localNotificationReceived
。
@Override
public void localNotificationReceived(String notificationId) {
Dialog.show("Welcome Back", "Have wonderful time ahead", "Ok", null);
f.revalidate();
}
的問題是:
通知給出了錯誤的Android API級別< 16.我認爲這個問題是不是正在使用的支持庫。如何使用支持庫?
在api級別16及以上版本中,顯示通知但點擊通知後,
localNotificationReceived
中的對話框未顯示。當應用程序從最近刪除時,應用程序不顯示任何通知和崩潰。
你能提供這方面的見解嗎?
你定義任何構建提示嗎?通常支持應該隱含在版本中 –
不,我不知道這一點。我現在就開始工作。 問題2和3的情況。localNotificationReceived中的代碼未被調用。如果應用程序從最近的應用程序中刪除,該應用程序崩潰沒有任何通知。 – umuieme
我對這件事並不十分了解,我已經讓@ chen-fishbein去看看 –