在创建PendingIntent时,要求指定FLAG_IMMUTABLE或FLAG_MUTABLE之一,以针对S+(版本31及以上)进行目标定位。强烈建议使用FLAG_IMMUTABLE,仅在某些功能依赖于PendingIntent可变性时使用FLAG_MUTABLE。
我无法在Android Studio项目代码中更新pending intent标志
这是AlarmPingSender.java中出现错误的位置
public void start()
{
String action = MqttServiceConstants.PING_SENDER
+ comms.getClient().getClientId();
Log.d(TAG, "Register alarmreceiver to MqttService"+ action);
service.registerReceiver(alarmReceiver, new IntentFilter(action));
pendingIntent = PendingIntent.getBroadcast(service, 0, new Intent(
action), PendingIntent.FLAG_UPDATE_CURRENT);
schedule(comms.getKeepAlive());
hasStarted = true;
}
帮我解决问题 在Android Studio中出现错误的图片