Skip to content

Commit 97b138e

Browse files
committed
Use newly created method in AndroidTools to register receiver for Andorid 14.
Don't use get in For loop
1 parent c05011a commit 97b138e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,11 @@ private void requestUsbAccessory(Context context) {
110110
}
111111
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
112112
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
113-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
114-
context.registerReceiver(usbPermissionReceiver, filter, Context.RECEIVER_EXPORTED);
115-
}
116-
for (final UsbAccessory usbAccessory : manager.getAccessoryList()) {
113+
114+
AndroidTools.registerReceiver(context, usbPermissionReceiver, filter,
115+
Context.RECEIVER_EXPORTED);
116+
117+
for (final UsbAccessory usbAccessory : accessoryList) {
117118
manager.requestPermission(usbAccessory, mPermissionIntent);
118119
}
119120
}

0 commit comments

Comments
 (0)