【问题标题】:Android Notification click event run chain of activitiesAndroid 通知点击事件运行链活动
【发布时间】:2014-06-26 04:28:56
【问题描述】:

我的应用程序有传入消息的通知。我有一个 tabActivity,主要是在一些活动之后运行。

我的问题是当我点击通知时如何打开特定标签?

例如:

A----->B------>C------->D ------> Specific Tab

注意:A、B、C是正常活动,D是Tab活动

【问题讨论】:

  • 将整个活动链中的捆绑包传递给正确的活动,这就是我的做法

标签: android android-intent notifications


【解决方案1】:

你的意思是任务栏通知?如果是,您可以使用待处理的意图来解决问题

我遇到了同样的问题检查这个链接

Cannot Send data Through pendingIntent

http://www.tutorialspoint.com/android/android_notifications.htm

【讨论】:

    【解决方案2】:

    我是如何做到的,是在开始每个活动并继续前进时使用 putExtra()getExtra()。格式有点

    来自您的 GCMBroadCastIntent:

     Intent notificationIntent = new Intent(this,A.class);
        notificationIntent.putExtra("setFragment", "D");
    

    在一个onCreate()中:

     if (getIntent()!=null  && getIntent().getExtras()!=null 
            && getIntent().getExtras().containsKey("setFragment")); 
         if (getIntent().getExtras().getString("setFragment").equalsIgnoreCase("D"))
                 mainIntent.putExtra("setFragment", "D");
             startActivity(mainIntent);
    

    同样适用于 B,C : 从 C 导航到 D。

    检查意图并在 C 的 onCreate() 中执行所需的操作以到达 D。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-07
      • 2015-06-14
      • 2020-07-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多