Loading app/src/main/java/net/sourceforge/opencamera/remotecontrol/BluetoothRemoteControl.java +12 −1 Original line number Diff line number Diff line package net.sourceforge.opencamera.remotecontrol; import static android.content.Context.RECEIVER_NOT_EXPORTED; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -262,8 +264,17 @@ public class BluetoothRemoteControl { if( MyDebug.LOG ) Log.d(TAG, "Remote enabled, starting service"); main_activity.bindService(gattServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE); // For Android 14 (UPSIDE_DOWN_CAKE) onwards, a flag of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED must be specified when using // registerReceiver with non-system intents, otherwise a SecurityException will be thrown. // The if condition is for TIRAMISU as there seems no harm doing this for earlier versions too, but RECEIVER_NOT_EXPORTED // requires Android 13. if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ) { main_activity.registerReceiver(remoteControlCommandReceiver, makeRemoteCommandIntentFilter(), RECEIVER_NOT_EXPORTED); } else { main_activity.registerReceiver(remoteControlCommandReceiver, makeRemoteCommandIntentFilter()); } } else { if( MyDebug.LOG ) Log.d(TAG, "Remote disabled, stopping service"); Loading Loading
app/src/main/java/net/sourceforge/opencamera/remotecontrol/BluetoothRemoteControl.java +12 −1 Original line number Diff line number Diff line package net.sourceforge.opencamera.remotecontrol; import static android.content.Context.RECEIVER_NOT_EXPORTED; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -262,8 +264,17 @@ public class BluetoothRemoteControl { if( MyDebug.LOG ) Log.d(TAG, "Remote enabled, starting service"); main_activity.bindService(gattServiceIntent, mServiceConnection, Context.BIND_AUTO_CREATE); // For Android 14 (UPSIDE_DOWN_CAKE) onwards, a flag of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED must be specified when using // registerReceiver with non-system intents, otherwise a SecurityException will be thrown. // The if condition is for TIRAMISU as there seems no harm doing this for earlier versions too, but RECEIVER_NOT_EXPORTED // requires Android 13. if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ) { main_activity.registerReceiver(remoteControlCommandReceiver, makeRemoteCommandIntentFilter(), RECEIVER_NOT_EXPORTED); } else { main_activity.registerReceiver(remoteControlCommandReceiver, makeRemoteCommandIntentFilter()); } } else { if( MyDebug.LOG ) Log.d(TAG, "Remote disabled, stopping service"); Loading