如何解决当应用终止或在后台运行时,无法通过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 举报,一经查实,本站将立刻删除。