当应用终止或在后台运行时,无法通过fcm通知启动活动

问题描述

我需要启动一个设备振铃活动,我收到了fcm通知。当应用程序处于Forground状态时,它可以正常工作。如果应用程序处于后台或终止状态,我正在接收通知,但该活动尚未开始

operation.setStatus(resources.getString(R.string.operation_value_completed));
        resultBuilder.build(operation);
        Intent intent = new Intent(context,AlertActivity.class);
        intent.putExtra(resources.getString(R.string.intent_extra_type),resources.getString(R.string.intent_extra_ring));
        intent.putExtra(resources.getString(R.string.intent_extra_message_text),resources.getString(R.string.intent_extra_stop_ringing));
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP |
                Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
        context.startActivity(intent);
    
        if (Constants.DEBUG_MODE_ENABLED) {
            Log.d(TAG,"Ringing is activated on the device");
        }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)