Open PeterStaev opened 1 year ago
Just to clarify - although the permission seems declined I get a token, can register the device and receive notifications w/o any problem on the simulator.
I may have missed an edge case but when testing on API 33 you will need to set the target and compile sdks to 33
Changing compile and target SDK actually fixed the problem! Thanks @triniwiz ! I will leave this open in case the reject logic should also be changed so that it matches the iOS side.
I'm trying to migrate from the old firebase plugin to this one, and I'm getting some strange problem testing on a simulator with API 33. As soon as I call the request permissions, I do not get any prompts and I get a rejection. Here is a sample code:
From what I see it is because of this: https://github.com/NativeScript/firebase/blob/889726640381cb4a0cdbe855f658ff3245a0eb3d/packages/firebase-messaging-core/index.android.ts#L314-L319
Does requesting permissions for notifications work only on physical devices?
Also why does this code
reject
while the iOS code resolves even if permission is denied but with the correct status code? Shouldn't this be changed toresolve(AuthorizationStatus.DENIED)
for better cross platform interoperability? Right now I have to surround the request call with an empty try/catch to simulate similar behavior as on iOS.