2017-02-21 70 views
1

打開我想在我的應用程序是通過本地通知開來檢測和閱讀通知的標識,類似基於其ID來推送通知類型3.檢測時,應用程序從LocalNotification

LocalNotification應該打開一個特定的形式或任何隱藏的值,但它沒有一個監聽器在單擊時讀取它的標題,ID或正文。

下面是我的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); 

任何想法或劈爲我做到這一點,將不勝感激。

回答

2

在你的主類,你可以補充一點:

public class MyMainClass implements LocalNotificationCallback 

然後,你可以覆蓋的方法:

@Override 
public void localNotificationReceived(String notificationId) { 
    //do some stuff 
} 

下面是一些有用的鏈接:java docCN1's blog post

+0

謝謝爲解決方案。 – Diamond