2011-08-11 42 views
5

我正在android上做一個幫助臺應用程序。我想實施未讀門票的通知(客戶建議或投訴)。在這個應用程序的iPhone版本中,即使應用程序未打開應用程序圖標本身的未讀門票的計數器,是否可以在android中使用。如果是這樣,請幫助我像iPhone一樣實施,否則幫助我實現正常的android通知未讀門票。如何在android中做通知?

感謝

回答

9

調用此方法

private void triggerNotification(String s) { 
    CharSequence title = "Hello"; 
    CharSequence message = s; 
    NotificationManager notificationManager; 
    notificationManager = (NotificationManager) context 
      .getSystemService("notification"); 
    Notification notification; 
    notification = new Notification(
      com.yourPackage.R.drawable.notification, "Notifiy.. ", 
      System.currentTimeMillis()); 
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, 
     null, 0); 
    notification.setLatestEventInfo(context, title, message, pendingIntent); 
    notificationManager.notify(1010, notification); 
}