从通知中单击时打开应用程序并获取包数据

时间:2017-10-26 10:56:37

标签: android notifications

在Android中收到特定应用程序的通知时。 用户单击该通知。 它成功打开了应用程序。

我需要知道的是,它带有'捆绑'用它。 有人可以帮忙阅读吗

    {
   "to":"xyz",
   "notification":{
      "body":"Congratulations !!",
      "title":"abc",
      "icon":"myicon",
      "sound":"mySound",
      "badge":"5"
   },
   "payload":{
      "aps":{
         "alert":{
            "type":"gallery_listing",
            "sub_type":"approval_of_selfie",
            "notif_header":"Approval of Selfie",
            "notif_message":"Congratulations your selfie is approved",
            "notif_id":"12345",
            "image_path":""
         }
      }
   }
    }



 Intent intent = this.getIntent();
     if (intent != null && intent.getExtras() != null && (intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
        Log.d("sk_log", "Notification ===1======="+intent.getExtras().get("notification"));
        }

1 个答案:

答案 0 :(得分:0)

我似乎想要查看Intent / Bundle中的所有可用键。您可以通过以下链接查看答案:

Listing all extras of an Intent

希望这会对你有所帮助。