我需要启动一个设备振铃活动,我收到了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");
}