NativeScript / NativeScript/firebase
[messaging-core] Problems with requesting permissions on Android 33
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 62
- Forks
- 53
- Avg merge
- 8d 4h
- Merged PRs (30d)
- 2
Description
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:
export async function onTap() {
try {
const result = await MessagingCore.getInstance().requestPermission();
console.log("RES", result);
}
catch (e) {
console.error("ERROR", e);
}
}
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 to resolve(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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/firebase-messaging-core/index.android.ts at lines 314-319 and trace the Android 33 requestPermission path using the sample call in the issue. Compare its rejection behavior with the iOS implementation described by the reporter. Done means the emulator or device behavior is understood and the denied-permission result is consistent with the stated cross-platform expectation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, firebase, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100