我通過BroadcastReceiver在我的應用程序中得到通知,問題是,我如何解析數據到一個活動並與接收到的數據進行對話?android-如何顯示一個對話框,當點擊通知
這是我的代碼,但是當我點擊該通知,沒有任何反應:
NotificationManager notificationManager = (NotificationManager) ctx.getSystemService(Context.NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(Intent.ACTION_VIEW);
notificationIntent.setData(Uri.parse(link));
PendingIntent pending = PendingIntent.getActivity(ctx, 0, notificationIntent, Intent.FLAG_ACTIVITY_NEW_TASK);
Notification myNotification = new NotificationCompat.Builder(ctx)
.setSmallIcon(R.drawable.ic_launcher).setAutoCancel(false).setLargeIcon(remote_picture)
.setContentTitle(onvan).setStyle(new NotificationCompat.BigTextStyle().bigText(msg))
.setContentText(msg).setContentIntent(pending).build();
notificationManager.notify(1, myNotification);
我有一些像variablese鏈接,味精,onvan包含我的數據,我需要這些變量發送到活動並進行對話。
我該怎麼做?
就地檢查我的答案。 – Harshad
http://stackoverflow.com/a/9751134/3514144 –
使用活動作爲對話http://stackoverflow.com/a/1979631/1168654 –