Skip to content

Commit

Permalink
Fix bad version check on Android 12 and earlier
Browse files Browse the repository at this point in the history
See #9
  • Loading branch information
cgutman committed Jul 28, 2024
1 parent 6c66a00 commit 509ba12
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions app/src/main/java/org/cgutman/usbip/config/UsbIpConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ public void onClick(View v) {
stopService(new Intent(UsbIpConfig.this, UsbIpService.class));
}
else {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (ContextCompat.checkSelfPermission(UsbIpConfig.this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
startService(new Intent(UsbIpConfig.this, UsbIpService.class));
} else {
requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS);
}
if (ContextCompat.checkSelfPermission(UsbIpConfig.this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
startService(new Intent(UsbIpConfig.this, UsbIpService.class));
} else {
requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS);
}
}

Expand Down

0 comments on commit 509ba12

Please sign in to comment.