像我这样的假人: 在MainActivity上获取此yourpackage.notifyId:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Bundle intent_extras = getIntent().getExtras(); if (intent_extras != null && intent_extras.containsKey("yourpackage.notifyId")) { //Do the codes } }
在我的情况下 - 使用它来确定谁正在打开我的主动,用户或来自通知的呼叫,由GcmIntentService控制... 附:我使用的名称没有“youpackage”,工作正常。