Skip to content

Conversation

@HarelM
Copy link
Contributor

@HarelM HarelM commented Jul 23, 2025

In this PR I did the following:

  1. Made the indentation smaller by checking conditions and returning fast
  2. I extracted the notification creation to a method
  3. I Added runtime request for post notification when backgroundMessage is defined
  4. I moved some methods around to facilitate cases where permission are granted and not granted.

This also solves an issue for when running the app for the first time and there was a code flow that would create the notification and create a watcher even though the permission is not granted, so there was an error in the logcat.

requestPermissionForAlias("location", call, "locationPermissionsCallback");
} else {
call.reject("Permission denied.", "NOT_AUTHORIZED");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these nested if blocks are easier to understand. Why did you change it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a hard time understanding the flow... I guess it's a matter of taste...
I also saw that keepAlive was called in a place it didn't need to be called due to the nesting of the ifs...

requestPermissionForAlias("notifications", call, "notificationsPermissionsCallback");
return;
}
service.addWatcher(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be replaced with a direct call to notificationsPermissionsCallback?

@diachedelic
Copy link
Collaborator

This PR certainly needs to implement equivalent functionality for iOS before being merged.

@HarelM
Copy link
Contributor Author

HarelM commented Jul 31, 2025

I don't think there's an iOS equivalent to this, this is an Android requirement as far as I understand.

@diachedelic
Copy link
Collaborator

Excellent point.

@HarelM
Copy link
Contributor Author

HarelM commented Aug 5, 2025

I've moved to maintain the following plugin:
https://github.com/Cap-go/background-geolocation

Sorry for splitting the echosystem and community, but I needed full control over the code due to the importance of this plugin in my app.

Feel free to copy anything you'd like, or close issues I opened.
Let me know if there's anything I can help with.

@diachedelic
Copy link
Collaborator

Thanks, that is absolutely fine with me. I have little time to maintain this plugin beyond fixing bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POST_NOTIFICATION permission in Android

2 participants