NativeScript / NativeScript/firebase

[messaging-core] Problems with requesting permissions on Android 33

Open
#168 3 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.