Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

未關閉
#168 3 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
android, firebase, typescript
領域
mobile

研究方向

從 packages/firebase-messaging-core/index.android.ts 的第 314-319 行開始,使用 issue 中的範例呼叫追蹤 Android 33 的 requestPermission 路徑。將其遭拒時的行為與回報者描述的 iOS 實作進行比較。當已了解模擬器或裝置上的行為,且遭拒權限的結果與所述的跨平台預期一致時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
TypeScript
星號
62
分支
53
平均合併
7 分鐘
30 天內合併 PR
1

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

NativeScript/firebase 的其他 Issue

查看 NativeScript/firebase 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。