检测何时从 LocalNotification 打开应用程序
Detect when app is opened from LocalNotification
我想通过本地通知检测何时打开我的应用程序并读取通知的 Id,类似于推送通知类型 3。
LocalNotification 应根据其 ID 或任何隐藏值打开特定表单,但它没有侦听器来读取其标题、ID 或单击时 body。
以下是我的 LocalNotification 用法:
final LocalNotification ln = new LocalNotification();
ln.setAlertTitle("Booking request reminder:\n");
ln.setAlertBody(currentBooking.get("BookingDetails").toString());
ln.setAlertImage("/booking_image.jpg");
ln.setId(currentBooking.get("BookingId").toString());
Display.getInstance().scheduleLocalNotification(ln, System.currentTimeMillis() + 3600000, LocalNotification.REPEAT_NONE);
任何能帮助我实现这一目标的想法或技巧都将不胜感激。
在您的主 Class 中,您可以添加:
public class MyMainClass implements LocalNotificationCallback
然后,您可以覆盖方法:
@Override
public void localNotificationReceived(String notificationId) {
//do some stuff
}
这里有一些有用的东西link:java doc and CN1's blog post
我想通过本地通知检测何时打开我的应用程序并读取通知的 Id,类似于推送通知类型 3。
LocalNotification 应根据其 ID 或任何隐藏值打开特定表单,但它没有侦听器来读取其标题、ID 或单击时 body。
以下是我的 LocalNotification 用法:
final LocalNotification ln = new LocalNotification();
ln.setAlertTitle("Booking request reminder:\n");
ln.setAlertBody(currentBooking.get("BookingDetails").toString());
ln.setAlertImage("/booking_image.jpg");
ln.setId(currentBooking.get("BookingId").toString());
Display.getInstance().scheduleLocalNotification(ln, System.currentTimeMillis() + 3600000, LocalNotification.REPEAT_NONE);
任何能帮助我实现这一目标的想法或技巧都将不胜感激。
在您的主 Class 中,您可以添加:
public class MyMainClass implements LocalNotificationCallback
然后,您可以覆盖方法:
@Override
public void localNotificationReceived(String notificationId) {
//do some stuff
}
这里有一些有用的东西link:java doc and CN1's blog post