简体   繁体   English

在通知android上恢复当前后台活动

[英]resume current background activity on notification android

I have multiple activities in my application. 我的申请中有多项活动。 I want when notification shows in the bar, and clicking on it, it will resume from the activity which is currently in background. 我想要通知显示在栏中,然后单击它,它将从当前处于后台的活动中恢复。

Currently, I am using this, but it will always take me to the Home Activity which is Launcher activity. 当前,我正在使用此功能,但它将始终将我带到“启动器”活动即“主页”活动。

Intent intent =new Intent(ServiceClass.this, home.class);
PendingIntent pendingIntent = PendingIntent.getActivity(GcmIntentService.this, 0, intent, 0);

use the same intent filters as android uses when launches the app: 启动应用时,使用与android使用的意图过滤器相同的意图过滤器:

    final Intent notificationIntent = new Intent(context, YourActivity.class);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM