2013-02-28 42 views
0

說明: 我已經使用了守護線程。 在我的應用程序中,當用戶發送任何文件(.jpg,.txt,.pdf等)時,它會爲每個文件生成單獨的通知。 假設有3個通知。 當用戶點擊任何通知時,它會根據文件調用android.content.Intent.ACTION_VIEW並提示openwith選項。單擊Android通知不顯示活動選擇器

問題: 當用戶選擇通知它將在相應的應用被打開(例如如果用戶選擇sample.txt的那麼它將在colornote被打開)之後和 當在另一個通知用戶抽頭然後它會做什麼也沒有發生,同樣的事情發生。

我也通過了唯一ID的通知..!

long timestamp=System.currentTimeMillis(); 

int i=(int) timestamp; 

mNotificationManager.notify(i, mBuilder.build()); 

請幫我看看這個錯誤。

回答

2

您需要添加PendingIntent到您的通知建設者:

TaskStackBuilder stackBuilder = TaskStackBuilder.create(this); 
// Adds the back stack for the Intent (but not the Intent itself) 
stackBuilder.addParentStack(MyActivity.class); 
// Adds the Intent that starts the Activity to the top of the stack 
stackBuilder.addNextIntent(resultIntent); 
PendingIntent resultPendingIntent = 
     stackBuilder.getPendingIntent(
      0, 
      PendingIntent.FLAG_UPDATE_CURRENT 
     ); 
mBuilder.setContentIntent(resultPendingIntent); 

閱讀這篇文章:Creating a Simple Notification

+0

@菲爾 - 感謝名單烏拉圭回合樣的答覆?我已經執行什麼ü在這裏寫道。 ..still我不知道我在哪裏做錯了..! – TheFlash 2013-03-01 04:39:27