Skip to content

Commit

Permalink
Notification permission fix
Browse files Browse the repository at this point in the history
Notification permission fix
  • Loading branch information
oaliaga committed Oct 23, 2023
1 parent 5478240 commit 7fe5bf2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/src/main/java/com/prey/events/factories/EventFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ public void run() {
}
if (AIRPLANE_MODE.equals(intent.getAction())) {
if (!isAirplaneModeOn(ctx)) {
notification(ctx);
boolean verifyNotification = verifyNotification(ctx);
if (!verifyNotification) {
notification(ctx);
}
boolean connected = false;
if (!PreyConnectivityManager.getInstance(ctx).isWifiConnected()) {
Bundle extras = intent.getExtras();
Expand Down Expand Up @@ -219,11 +222,10 @@ public static boolean isValidLowBattery(Context ctx) {
* @return if you have all permissions
*/
public static boolean verifyNotification(Context ctx) {
boolean canAccessCamera = PreyPermission.canAccessCamera(ctx);
boolean canAccessCoarseLocation = PreyPermission.canAccessCoarseLocation(ctx);
boolean canAccessFineLocation = PreyPermission.canAccessFineLocation(ctx);
boolean canAccessStorage = PreyPermission.canAccessStorage(ctx);
return canAccessCamera && (canAccessCoarseLocation || canAccessFineLocation) && canAccessStorage;
return (canAccessCoarseLocation || canAccessFineLocation) && canAccessStorage;
}

/**
Expand Down

0 comments on commit 7fe5bf2

Please sign in to comment.