[Bug]: status() returns STATUS_AVAILABLE while battery usage is Restricted
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
issueでリンクされているAndroidの実装、android/tsbackgroundfetch/src/main/java/com/transistorsoft/tsbackgroundfetch/BackgroundFetch.javaを読み、特にstatus()を確認してください。Androidがバックグラウンド使用の制限をどのように報告するかを調べ、期待されるステータス定数と比較してください。バックグラウンド使用が制限されている場合にstatus()がSTATUS_DENIEDを報告し、その動作がAndroid 9以降で検証されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Required Reading
- Confirmed
Plugin Version
4.4.2 (tsbackgroundfetch 4.1.1)
Mobile operating-system(s)
- iOS
- Android
Device Manufacturer(s) and Model(s)
Xiaomi 14T
Device operating-systems(s)
Android 16
React Native / Expo version
0.88.1
What happened?
status() always returns STATUS_AVAILABLE, also when the app's battery usage is Restricted, which blocks the fetch job in the background. Expected STATUS_DENIED, as on iOS when the user turns Background App Refresh off:
public static final int STATUS_DENIED = 1; // matches the JS constant
public int status() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
if (am != null && am.isBackgroundRestricted()) return STATUS_DENIED;
}
return STATUS_AVAILABLE;
}
If status() is meant to be iOS-only, a note in the docs would help.
Plugin Code and/or Config
BackgroundFetch.configure(
{
minimumFetchInterval: 15,
stopOnTerminate: false,
startOnBoot: true,
enableHeadless: true,
},
onFetch,
onTimeout
);
await BackgroundFetch.status(); // 2 while Restricted
Relevant log output
Restricted (adb shell cmd appops set <pkg> RUN_ANY_IN_BACKGROUND ignore), app in the background, adb shell am make-uid-idle <pkg>, from dumpsys jobscheduler:
JOB #u0a558/999: … com.transistorsoft.tsbackgroundfetch.FetchJobService
Satisfied constraints: DEVICE_NOT_DOZING WITHIN_QUOTA SSRU [0xb000000]
readyNotRestrictedInBg: false
STOP-P: #u0a558/999 … FetchJobService constraints
Allowed, same steps:
Satisfied constraints: FLEXIBILITY DEVICE_NOT_DOZING BACKGROUND_NOT_RESTRICTED WITHIN_QUOTA SSRU [0xb600000]
readyNotRestrictedInBg: true
D TSBackgroundFetch: - Background Fetch event received: react-native-background-fetch
- 主要言語
- Java
- スター
- 1.6k
- フォーク
- 194
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
transistorsoft/react-native-background-fetch のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
transistorsoft/react-native-background-fetch#582 · コメント 2 件 ·
transistorsoft/react-native-background-fetch の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
NationalSecurityAgency/ghidra#10220 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
メンテナーはふだん 1 日以内に返信
-
RIS export splits an organization name containing “and” into multiple authors対応中かも @Gautam-aman が今日担当しました。 オープンstatus: needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JabRef/jabref#17821 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
FailureContext.java rounds down thresholds in lastedAtLeast()対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信