2014-07-07 79 views
0

我曾經閱讀this topic about NotificationCompat,我知道contentIntent是薑餅及以下版本所必需的。但是,我在Android薑餅工作,我不想添加PendingIntent。我該怎麼做才能得到正確的通知?
感謝您的幫助Android薑餅中的NotificationCompat不起作用

NotificationCompat.Builder builder = new NotificationCompat.Builder(this); 
    builder.setAutoCancel(true); 
    builder.setContentTitle("Basic notification"); 
    builder.setContentText(content); 
    builder.setSmallIcon(R.drawable.ic_launcher); 

    Notification notification = builder.build(); 
    try { 
     NotificationManager manager = (NotificationManager) this 
       .getSystemService(NOTIFICATION_SERVICE); 

     manager.notify(8, notification); 
    } catch (Exception e) { 
     Log.i("Exception", e.getMessage()); 
    } 

異常:contentIntent要求:PKG = com.example.notificationtutorial ID = 8通知=通知(振動= NULL,聲音= null,則默認爲0x0 =,=標誌爲0x10)

回答