Merged
feat: add harmony support #3
Frank_SummerAdd on Nov 6, 2025
feat: add harmony support #3
Merged
Total: 184 files changed+1160-15776
| @@ -1,25 +0,0 @@ | |||
| 1 | -name: Close inactive issues | ||
| 2 | -on: | ||
| 3 | - schedule: | ||
| 4 | - - cron: "30 1 * * *" | ||
| 5 | - | ||
| 6 | -jobs: | ||
| 7 | - close-issues: | ||
| 8 | - runs-on: ubuntu-latest | ||
| 9 | - permissions: | ||
| 10 | - issues: write | ||
| 11 | - pull-requests: write | ||
| 12 | - steps: | ||
| 13 | - - uses: actions/stale@v5 | ||
| 14 | - with: | ||
| 15 | - operations-per-run: 100 | ||
| 16 | - days-before-issue-stale: 30 | ||
| 17 | - days-before-issue-close: 14 | ||
| 18 | - stale-issue-label: "stale" | ||
| 19 | - stale-issue-message: "This issue is stale because it has been open for 30 days with no activity." | ||
| 20 | - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale." | ||
| 21 | - days-before-pr-stale: -1 | ||
| 22 | - days-before-pr-close: -1 | ||
| 23 | - repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
| 24 | - | ||
| 25 | - | ||
| @@ -1,53 +0,0 @@ | |||
| 1 | -# Logs | ||
| 2 | -logs | ||
| 3 | -*.log | ||
| 4 | -npm-debug.log* | ||
| 5 | - | ||
| 6 | -# Runtime data | ||
| 7 | -pids | ||
| 8 | -*.pid | ||
| 9 | -*.seed | ||
| 10 | - | ||
| 11 | -# Directory for instrumented libs generated by jscoverage/JSCover | ||
| 12 | -lib-cov | ||
| 13 | - | ||
| 14 | -# Coverage directory used by tools like istanbul | ||
| 15 | -coverage | ||
| 16 | - | ||
| 17 | -# nyc test coverage | ||
| 18 | -.nyc_output | ||
| 19 | - | ||
| 20 | -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
| 21 | -.grunt | ||
| 22 | - | ||
| 23 | -# node-waf configuration | ||
| 24 | -.lock-wscript | ||
| 25 | - | ||
| 26 | -# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
| 27 | -build/Release | ||
| 28 | - | ||
| 29 | -package-lock.json | ||
| 30 | - | ||
| 31 | -# Dependency directories | ||
| 32 | -node_modules | ||
| 33 | -jspm_packages | ||
| 34 | - | ||
| 35 | -# Optional npm cache directory | ||
| 36 | -.npm | ||
| 37 | - | ||
| 38 | -# Optional REPL history | ||
| 39 | -.node_repl_history | ||
| 40 | - | ||
| 41 | -.DS_Store | ||
| 42 | - | ||
| 43 | -android/build | ||
| 44 | -android/*.iml | ||
| 45 | - | ||
| 46 | -xcuserdata/ | ||
| 47 | -android/.gradle | ||
| 48 | - | ||
| 49 | -android/local.properties | ||
| 50 | - | ||
| 51 | -# Expo build | ||
| 52 | -expo/plugin/build/** | ||
| 53 | - | ||
| @@ -1,8 +0,0 @@ | |||
| 1 | -.DS_Store | ||
| 2 | -docs/ | ||
| 3 | -example/ | ||
| 4 | -*.md | ||
| 5 | -node_modules | ||
| 6 | -.github/ | ||
| 7 | -expo/plugin/src | ||
| 8 | -expo/plugin/tsconfig.json | ||
| @@ -1,394 +0,0 @@ | |||
| 1 | -# CHANGELOG | ||
| 2 | - | ||
| 3 | -## 4.2.5 — 2024-04-22 | ||
| 4 | -* [iOS] Code-sign `TSBackgroundFetch.xcframework` with new Apple Organization (*9224-2932 Quebec Inc*) certificate. | ||
| 5 | - | ||
| 6 | -## 4.2.4 — 2024-03-23 | ||
| 7 | -* [iOS] codesign `TSBackgroundFetch` | ||
| 8 | -* [iOS] Add PrivacyInfo -> TSBackgroundFetch.xcframework | ||
| 9 | - | ||
| 10 | -## 4.2.3 — 2024-03-19 | ||
| 11 | -* [iOS] Implement new [iOS Privacy Manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files?language=objc) | ||
| 12 | - | ||
| 13 | -## 4.2.2 — 2024-01-29 | ||
| 14 | -* [Expo] Fix bug for Expo v50 "Invalid regular expression". | ||
| 15 | -* [iOS] Only allow registration of `BGProcessingTasks` (*Permitted background task scheduler identifiers*) in `Info.plist` which are prefixed with `com.transistorsoft`. Any other task identifier will be ignored. | ||
| 16 | - | ||
| 17 | -## [4.2.1] — 2023-08-20 | ||
| 18 | -* [Android] Detect and dispose of duplicate events. Android `JobService` has a bug for devices running <= Android M where multiple `backgrou | ||
| 19 | -nd-fetch` events could fire within the same second. | ||
| 20 | - | ||
| 21 | -## [4.2.0] — 2023-07-31 | ||
| 22 | -* [Android] Android 14 (SDK 34) support. | ||
| 23 | -* [Android] Android 14 (SDK 34) support: When using `forceAlarmManager: true`, you must now optionally add the permission `android.permission.USE_EXACT_ALARM` to your `AndroidManifest` to schedule **exact** alarms. Otherwise `AlarmManager` will use **in-exact** alarms. **NOTE** You must include the permission **exactly as-shown** with __`android:minSdkVersion="34"`__. | ||
| 24 | - | ||
| 25 | -:open_file_folder: `AndroidManifest` | ||
| 26 | -```xml | ||
| 27 | -<manifest> | ||
| 28 | - <!-- [background-fetch] OPTIONAL: allows forceAlarmManager: true to use exact alarms --> | ||
| 29 | - <uses-permission android:name="android.permission.USE_EXACT_ALARM" android:minSdkVersion="34" /> | ||
| 30 | - . | ||
| 31 | - . | ||
| 32 | - . | ||
| 33 | -</manifest> | ||
| 34 | -``` | ||
| 35 | - | ||
| 36 | -## [4.1.10] — 2023-05-03 | ||
| 37 | -* [Android] Gradle v8 now requires `namespace` attribute in gradle files. | ||
| 38 | - | ||
| 39 | -## [4.1.9] — 2023-03-13 | ||
| 40 | -* [Android] Fix expo plugin failing on Expo SDK >= 48. Regular expressions failed because Expo changed lines in the build.gradle files that the Expo plugin was using for anchors for where to inject new src. Changed to use more fundamental anchor elements for regular expressions that must exist. | ||
| 41 | -* [Android] Fix expo plugin failing on Expo SDK >= 48. Regular expressions failed because Expo changed lines in the build.gradle files that the Expo plugin was using for anchors for where to inject new src | ||
| 42 | -c | ||
| 43 | - | ||
| 44 | -## [4.1.8] — 2023-01-23 | ||
| 45 | -* [Android] Log JobScheduler jobId to facilitate simulating scheduleTask events with `adb shell`: | ||
| 46 | -```bash | ||
| 47 | -// from adb logcat *:S TSBackgroundFetch | ||
| 48 | -TSBackgroundFetch: - registerTask: com.transistorsoft.customtask (jobId: -359368280) <-- | ||
| 49 | -``` | ||
| 50 | -Now copy that `jobId` from logcat and insert into the `adb shell` command to simulate a task: | ||
| 51 | -```bash | ||
| 52 | -$ adb shell cmd jobscheduler run -f com.your.package.name -359368280 | ||
| 53 | -``` | ||
| 54 | - | ||
| 55 | -## [4.1.7] — 2022-12-15 | ||
| 56 | -* Fix typo in previous release. | ||
| 57 | - | ||
| 58 | -## [4.1.6] — 2022-12-15 | ||
| 59 | -* `TaskConfig.requiresNetworkConnectivity` was missing from typescript API. | ||
| 60 | - | ||
| 61 | -## [4.1.5] — 2022-10-25 | ||
| 62 | -* Remove `peerDependencies`. | ||
| 63 | - | ||
| 64 | -## [4.1.4] — 2022-10-25 | ||
| 65 | -* [Expo] The plugin now implements an Expo `ConfigPlugin` for automated Setup. | ||
| 66 | - | ||
| 67 | -## [4.1.3] — 2022-10=11 | ||
| 68 | -* [Android] Use `LifecycleManager` for modern headless-detection instead of legacy mechanism requiring permission `GET_TASKS`. | ||
| 69 | - | ||
| 70 | -## [4.1.2] — 2022-07-28 | ||
| 71 | -* [Android] Implement gradle ext variable getter `minSdkVersion` instead of hard-coded `16`. | ||
| 72 | - | ||
| 73 | -## [4.1.1] — 2022-06-28 | ||
| 74 | -* Fix issue for react-native 0.69: They made a breaking change with the old, unused react-native.config.js, causing builds to fail. Simply delete the file `react-native.config.js`. | ||
| 75 | - | ||
| 76 | -## [4.1.0] — 2022-04-06 | ||
| 77 | -* [Android] Add new permission required for Android 12: android.permission.SCHEDULE_EXACT_ALARM | ||
| 78 | - | ||
| 79 | -## [4.0.5] — 2022-02-10 | ||
| 80 | -* [Fixed][iOS] Remove obsolete `__has_include("RCTEventEmitter.h")` code which was breaking Expo apps. | ||
| 81 | - | ||
| 82 | -## [4.0.4] — 2021-10-22 | ||
| 83 | -* [Fixed] EventEmitter warning about `addListener` / `removeListeners` | ||
| 84 | -* [Changed] Re-generate /example app with `react-native init`. Complete re-factor to use React Hooks. | ||
| 85 | - | ||
| 86 | -## [4.0.3] — 2021-06-30 | ||
| 87 | -* [Changed][Android] Allow multiple calls to .configure to allow re-configuring the fetch task. Existing task will be cancelled and a new periodic fetch task re-scheduled according to new config. | ||
| 88 | -* [Changed][Android] Ignore initial fetch task fired immediately. | ||
| 89 | -* [Changed][Android] `android:exported="false"` on `BootReceiver` to resolve reported security analysis. | ||
| 90 | - | ||
| 91 | - | ||
| 92 | -## [4.0.2] — 2021-04-02 | ||
| 93 | -* [Fixed] Typescript definition for interface `HeadlessEvent` was missing `timeout: boolean` attribute. Thanks @mikehardy. | ||
| 94 | - | ||
| 95 | -## [4.0.1] — 2021-02-18 | ||
| 96 | - | ||
| 97 | -* [Fixed][Android] Fix `java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.transistorsoft.tsbackgroundfetch.BGTask.getTaskId()' on a null object reference` | ||
| 98 | -* [Fixed][iOS] Mistake implementing timeout callback for TSBackgroundFetch addListener. Provided old signature. | ||
| 99 | - | ||
| 100 | -## [4.0.0] — 2021-02-12 | ||
| 101 | - | ||
| 102 | -* [Added][iOS] Implement two new iOS options for `BackgroundFetch.scheduleTask`: | ||
| 103 | - - `bool requiresNetworkConnectivity` | ||
| 104 | - - `bool requiresCharging` (previously Android-only). | ||
| 105 | - | ||
| 106 | -* [Changed][iOS] Migrate `TSBackgroundFetch.framework` to new `.xcframework` for *MacCatalyst* support with new Apple silcon. | ||
| 107 | - | ||
| 108 | -### :warning: Breaking Change: Requires `cocoapods >= 1.10+`. | ||
| 109 | - | ||
| 110 | -*iOS'* new `.xcframework` requires *cocoapods >= 1.10+*: | ||
| 111 | - | ||
| 112 | -```bash | ||
| 113 | -$ pod --version | ||
| 114 | -// if < 1.10.0 | ||
| 115 | -$ sudo gem install cocoapods | ||
| 116 | -``` | ||
| 117 | - | ||
| 118 | -* [Added] task-timeout callback. `BackgroundFetch.configure` now accepts the 3rd callback argument as `onTimeout` callback. This callback will be executed when the operating system has signalled your background-time is about to expire. You must stop what your task is doing and execute `BackgroundFetch.finish(taskId)` immediately. | ||
| 119 | - | ||
| 120 | -```javascript | ||
| 121 | -let status = await BackgroundFetch.configure({ // <-- NEW: returns Promise | ||
| 122 | - minimumFetchInterval: 15 | ||
| 123 | -}, async (taskId) => { // <-- task callback. | ||
| 124 | - console.log("[BackgroundFetch] taskId:", taskId); | ||
| 125 | - BackgroundFetch.finish(taskId); | ||
| 126 | -}, async (taskId) => { // <-- NEW: task-timeout callback. | ||
| 127 | - // This task has exceeded its allowed running-time. | ||
| 128 | - // You must stop what you're doing immediately finish(taskId) | ||
| 129 | - // | ||
| 130 | - console.log("[BackgroundFetch] TIMEOUT taskId", taskId); | ||
| 131 | - BackgroundFetch.finish(taskId); | ||
| 132 | -}); | ||
| 133 | -``` | ||
| 134 | - | ||
| 135 | -### :warning: [Android] Breaking Change For Android Headless-task | ||
| 136 | -- Headless task event-object now includes a new attribute `event.timeout` when the OS signals your allowed background-time is about to expire. You must immediately finish what you're doing and call `BackgroundFetch.finish(taskId)` *immediately*. | ||
| 137 | - | ||
| 138 | -```javascript | ||
| 139 | -let myBackgroundFetchHeadlessTask = async (event) => { | ||
| 140 | - let taskId = event.taskId; | ||
| 141 | - let isTimeout = event.timeout; // <-- NEW: true if this task has timed-out. | ||
| 142 | - if (isTimeout) { | ||
| 143 | - // This task has exceeded its allowed running-time. | ||
| 144 | - // You must stop what you're doing immediately BackgroundFetch.finish(taskId) | ||
| 145 | - console.log("[BackgroundFetch] Headless TIMEOUT", taskId); | ||
| 146 | - BackgroundFetch.finish(taskId); | ||
| 147 | - return; | ||
| 148 | - } | ||
| 149 | - console.log("[BackgroundFetch] Headless task:", taskId); | ||
| 150 | - BackgroundFetch.finish(taskId); | ||
| 151 | -} | ||
| 152 | -BackgroundFetch.registerHeadlessTask(myBackgroundFetchHeadlessTask); | ||
| 153 | -``` | ||
| 154 | - | ||
| 155 | -* [Changed] API for `BackgroundGeolocation.configure` now returns a `Promise<BackgroundFetchStatus>` | ||
| 156 | - | ||
| 157 | -### :warning: Breaking Change: arguments to `BackgroundFetch.configure` | ||
| 158 | - | ||
| 159 | -__OLD__: | ||
| 160 | -When `BackgroundFetch` failed to start (eg: user disabled "Background Fetch" permission in your app settings), the *3rd argument* `failureCallback` would fire with the current `BackgroundFetchStatus`. | ||
| 161 | -```javascript | ||
| 162 | -BackgroundFetch.configure(options, eventCallback, failureCallback); | ||
| 163 | -``` | ||
| 164 | - | ||
| 165 | -__NEW__: | ||
| 166 | -The current `BackgroundFetchStatus` is now returned as a `Promise` when calling `.configure()`. The *3rd argument* is now `timeoutCallback`, executed when OS has signalled your allowed background time is about to expire: | ||
| 167 | -```javascript | ||
| 168 | -// BackgroundFetch event handler. | ||
| 169 | -const onEvent = async (taskId) => { // <-- task callback. | ||
| 170 | - console.log('[BackgroundFetch] task: ', taskId); | ||
| 171 | - // Do your background work... | ||
| 172 | - BackgroundFetch.finish(taskId); | ||
| 173 | -} | ||
| 174 | - | ||
| 175 | -// NEW: Timeout callback is executed when your Task has exceeded its allowed running-time. | ||
| 176 | -// You must stop what you're doing immediately BackgorundFetch.finish(taskId) | ||
| 177 | -const onTimeout = async (taskId) => { | ||
| 178 | - console.warn('[BackgroundFetch] TIMEOUT task: ', taskId); | ||
| 179 | - BackgroundFetch.finish(taskId); | ||
| 180 | -} | ||
| 181 | - | ||
| 182 | -// Initialize BackgroundFetch only once when component mounts. | ||
| 183 | -let status = await BackgroundFetch.configure({minimumFetchInterval: 15}, onEvent, onTimeout); | ||
| 184 | - | ||
| 185 | -console.log('[BackgroundFetch] configure status: ', status); | ||
| 186 | -``` | ||
| 187 | - | ||
| 188 | -## [3.1.0] — 2020-06-12 | ||
| 189 | -* [Fixed][Android] `com.android.tools.build:gradle:4.0.0` no longer allows "*direct local aar dependencies*". The Android Setup now requires a custom __`maven url`__ to be added to your app's root __`android/build.gradle`__: | ||
| 190 | - | ||
| 191 | -```diff | ||
| 192 | -allprojects { | ||
| 193 | - repositories { | ||
| 194 | - mavenLocal() | ||
| 195 | - maven { | ||
| 196 | - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
| 197 | - url("$rootDir/../node_modules/react-native/android") | ||
| 198 | - } | ||
| 199 | - maven { | ||
| 200 | - // Android JSC is installed from npm | ||
| 201 | - url("$rootDir/../node_modules/jsc-android/dist") | ||
| 202 | - } | ||
| 203 | -+ maven { | ||
| 204 | -+ // react-native-background-fetch | ||
| 205 | -+ url("${project(':react-native-background-fetch').projectDir}/libs") | ||
| 206 | -+ } | ||
| 207 | - | ||
| 208 | - } | ||
| 209 | -} | ||
| 210 | -``` | ||
| 211 | - | ||
| 212 | -## [3.0.6] — 2020-05-27 | ||
| 213 | -* [Fixed] Android check `wakeLock.isHeld()` before executing `wakeLock.release()`. | ||
| 214 | - | ||
| 215 | -## [3.0.5] — 2020-05-13 | ||
| 216 | -* [Fixed] Remove an unnecessary reference to `androidx` to allow the plugin to work with non-androidX for those using RN `<=0.59`. | ||
| 217 | -* [Added] Update *Android Setup* with new required `proguard-rules.pro` for those building release with `minifyEnabled true`. Fixes #261. | ||
| 218 | - | ||
| 219 | -1. Edit `android/app/proguard-rules.pro`. | ||
| 220 | -2. Add the following rule: | ||
| 221 | - | ||
| 222 | -```bash | ||
| 223 | -# [react-native-background-fetch] | ||
| 224 | --keep class com.transistorsoft.rnbackgroundfetch.HeadlessTask { *; } | ||
| 225 | -``` | ||
| 226 | - | ||
| 227 | -## [3.0.4] — 2020-03-24 | ||
| 228 | -* [Fixed] [iOS] Fixed bug calling `start` after executing `stop`. | ||
| 229 | - | ||
| 230 | -## [3.0.3] — 2020-02-21 | ||
| 231 | -* [Fixed] [Android] `stopOnTerminate: false` not cancelling scheduled job / Alarm when fired task fired after terminate. | ||
| 232 | - | ||
| 233 | -## [3.0.2] — 2020-02-20 | ||
| 234 | -* [Android] Fix Android NPE on `hasTaskId` when launched first time after upgrading to v3 | ||
| 235 | - | ||
| 236 | -## [3.0.1] — 2020-02-20 | ||
| 237 | - | ||
| 238 | -* [iOS] It's no longer necessary to __`registerAppRefreshTask`__ and __`registerBGProcessingTask`__ in `AppDelegate.m` The SDK now reads the App `.plist` and automatically registers those tasks found in *"Permitted background task scheduler identifiers"*, offering one simple setup method `didFinishLaunching`: Make the following change to your `AppDelegate.m`: | ||
| 239 | - | ||
| 240 | -```diff | ||
| 241 | -#import <TSBackgroundFetch/TSBackgroundFetch.h> | ||
| 242 | - | ||
| 243 | -@implementation AppDelegate | ||
| 244 | - | ||
| 245 | -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| 246 | - . | ||
| 247 | - . | ||
| 248 | - . | ||
| 249 | - // [react-native-background-fetch Setup] -- One easy step now: | ||
| 250 | -+ [[TSBackgroundFetch sharedInstance] didFinishLaunching]; | ||
| 251 | - | ||
| 252 | -- TSBackgroundFetch *fetch = [TSBackgroundFetch sharedInstance]; | ||
| 253 | -- // [REQUIRED] Register for usual periodic background refresh events here: | ||
| 254 | -- [fetch registerAppRefreshTask]; | ||
| 255 | - | ||
| 256 | -- // [OPTIONAL] IF you've registered custom "Background Processing Task(s)" in your Info.plist above, | ||
| 257 | -- // for use with #scheduleTask method, register each of those taskId(s) here as well. | ||
| 258 | -- [fetch registerBGProcessingTask:@"com.foo.customtask"]; | ||
| 259 | - | ||
| 260 | - return YES; | ||
| 261 | -} | ||
| 262 | -``` | ||
| 263 | - | ||
| 264 | - | ||
| 265 | -## [3.0.0] — 2020-02-17 | ||
| 266 | -* [Fixed] Android - Incorrect event signature for method stop (not receiving success, failure callbacks) | ||
| 267 | -* [Fixed] iOS - Missing native implementation for method scheduleTask. | ||
| 268 | -* [Changed] Bumped 2.8.0 to 3.0.0 to better flag this version for breaking changes. | ||
| 269 | - | ||
| 270 | -* [Added] [Android] New option `forceAlarmManager` for bypassing `JobScheduler` mechanism in favour of `AlarmManager` for more precise scheduling task execution. | ||
| 271 | -* [Changed] Migrate iOS deprecated "background-fetch" API to new [BGTaskScheduler](https://developer.apple.com/documentation/backgroundtasks/bgtaskscheduler?language=objc). See new required steps in iOS Setup. | ||
| 272 | -* [Added] Added new `BackgroundFetch.scheduleTask` method for scheduling custom "onehot" and periodic tasks in addition to the default fetch-task. | ||
| 273 | - | ||
| 274 | -```javascript | ||
| 275 | -BackgroundFetch.configure({ | ||
| 276 | - minimumFetchInterval: 15, | ||
| 277 | - stopOnTerminate: false | ||
| 278 | -}, (taskId) => { // <-- [NEW] taskId provided to Callback | ||
| 279 | - console.log("[BackgroundFetch] taskId: ", taskId); | ||
| 280 | - switch(taskId) { | ||
| 281 | - case 'foo': | ||
| 282 | - // Handle scheduleTask 'foo' | ||
| 283 | - break; | ||
| 284 | - default: | ||
| 285 | - // Handle default fetch event. | ||
| 286 | - break; | ||
| 287 | - } | ||
| 288 | - BackgroundFetch.finish(taskId); // <-- [NEW] Provided taskId to #finish method. | ||
| 289 | -}); | ||
| 290 | - | ||
| 291 | -// This event will end up in Callback provided to #configure above. | ||
| 292 | -BackgroundFetch.scheduleTask({ | ||
| 293 | - taskId: 'foo', //<-- required | ||
| 294 | - delay: 60000, | ||
| 295 | - periodic: false | ||
| 296 | -}); | ||
| 297 | -``` | ||
| 298 | - | ||
| 299 | -## Breaking Changes | ||
| 300 | -* With the introduction of ability to execute custom tasks via `#scheduleTask`, all tasks are executed in the Callback provided to `#configure`. As a result, this Callback is now provided an argument `String taskId`. This `taskId` must now be provided to the `#finish` method, so that the SDK knows *which* task is being `#finish`ed. | ||
| 301 | - | ||
| 302 | -```javascript | ||
| 303 | -BackgroundFetch.configure({ | ||
| 304 | - minimumFetchInterval: 15, | ||
| 305 | - stopOnTerminate: false | ||
| 306 | -), (taskId) => { // <-- [NEW] taskId provided to Callback | ||
| 307 | - console.log("[BackgroundFetch] taskId: ", taskId); | ||
| 308 | - BackgroundFetch.finish(taskId); // <-- [NEW] Provided taskId to #finish method. | ||
| 309 | -}); | ||
| 310 | -``` | ||
| 311 | - | ||
| 312 | -And with the Headless Task, as well: | ||
| 313 | -```javascript | ||
| 314 | -let backgroundFetchHeadlessTask = async (event) => { // <-- 1. Headless task receives {} | ||
| 315 | - // Get taskId from event {}: | ||
| 316 | - let taskId = event.taskId; | ||
| 317 | - console.log("[BackgroundFetch] Headless event received: ", taskId); | ||
| 318 | - | ||
| 319 | - BackgroundFetch.finish(taskId); // <-- 2. #finish with taskId here as well. | ||
| 320 | -} | ||
| 321 | - | ||
| 322 | -BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask); | ||
| 323 | - | ||
| 324 | -``` | ||
| 325 | - | ||
| 326 | -## [2.7.1] — 2019-10-06 | ||
| 327 | -- [Fixed] Resolve StrictMode violations; typically from accessing SharedPreferences on main-thread. | ||
| 328 | - | ||
| 329 | -## [2.7.0] — 2019-08-16 | ||
| 330 | -- [Added] Auto-linking support for `react-native >= 0.60`. See the *Auto-linking* setup in the README for more information. | ||
| 331 | - | ||
| 332 | -:warning: If you have a previous version of **`react-native-background-fetch < 2.7.0`** installed into **`react-native >= 0.60`**, you should first `unlink` your previous version as `react-native link` is no longer required. | ||
| 333 | - | ||
| 334 | -```bash | ||
| 335 | -$ react-native unlink react-native-background-fetch | ||
| 336 | -``` | ||
| 337 | - | ||
| 338 | -## [2.6.1] — 2019-07-04 | ||
| 339 | -- [Added] New `react-native.config.js` wanted by `react-native > 0.60.0`. https://github.com/react-native-community/cli/blob/master/docs/dependencies.md | ||
| 340 | - | ||
| 341 | -## [2.6.0] — 2019-05-30 | ||
| 342 | -- [Added] Added extra Android `JobInfo` constraints `requiredNetworkType`, `requiresCharing`, `requiresBatteryNotLow`, `requiresStorageNotLow`, `requiresDeviceIdle`. | ||
| 343 | -- [Fixed] Merge PR [transistor-background-fetch](https://github.com/transistorsoft/transistor-background-fetch/pull/4) | ||
| 344 | -- [Fixed] Merge PR [transistor-background-fetch](https://github.com/transistorsoft/transistor-background-fetch/pull/2) | ||
| 345 | - | ||
| 346 | -## [2.5.6] — 2019-05-09 | ||
| 347 | -- [Fixed] Monkey patch xcode npm module to ignore case in `findPBXGroupKeyAndType`. Some projects physical folder name might be "foo" but the XCode group-name might be "Foo". | ||
| 348 | - | ||
| 349 | -## [2.5.5] — 2019-05-09 | ||
| 350 | -- [Fixed] react-native link script failed for Expo apps. Failed to find projectGroup by name. Finds it by path or name now. | ||
| 351 | - | ||
| 352 | -## [2.5.4] — 2019-04-18 | ||
| 353 | -- [Fixed] Windows issue in new react-native link script for Android | ||
| 354 | - | ||
| 355 | -## [2.5.3] — 2019-04-15 | ||
| 356 | -- [Added] Added android implementation for `react-native link` script to automatically add the required `maven url`. No more extras steps required — simply: `react-native link react-native-background-fetch`. | ||
| 357 | - | ||
| 358 | -## [2.5.2] — 2019-04-10 | ||
| 359 | -- [Fixed] Fixed `react-native link` scripts to detect when installing into an app already configured for Cocoapods. | ||
| 360 | - | ||
| 361 | -## [2.5.1] — 2019-02-27 | ||
| 362 | -- [Changed] Remove unnecessary gradle directive `buildToolsVersion`. | ||
| 363 | - | ||
| 364 | -## [2.5.0] — 2019-02-07 | ||
| 365 | -- [Changed] Use updated gradle method `implementation` instead of deprecated `compile`. | ||
| 366 | - | ||
| 367 | -## [2.4.6] — 2019-01-11 | ||
| 368 | -- [Added] Android: Double check that app isn't in foreground before executing headless task (thanks to @macgregorT). | ||
| 369 | - | ||
| 370 | -## [2.4.5] — 2018-11-28 | ||
| 371 | -- [Fixed] Wrap Android HeadlessTask executor in try/catch to swallow errors if run while app is in foreground. | ||
| 372 | - | ||
| 373 | -## [2.4.4] — 2018-10-29 | ||
| 374 | -- [Fixed] react-native link scripts for Windows (PR #114) | ||
| 375 | -- [Added] Typescript definitions. | ||
| 376 | - | ||
| 377 | -## [2.4.3] — 2018-05-23 | ||
| 378 | -- [Fixed] Fix link error when iOS and npm project name are diferent | ||
| 379 | -- [Fixed] Clear event-listeners when `#configure` is called. When used with `react-native-background-geolocation` in "Headless Mode", this plugin could accumulate event-listeners with each reboot after terminate. | ||
| 380 | -- [Added] Add convenience method `BackgroundGeolocation#registerHeadlessTask`, to be used instead of `AppRegistry#registerHeadlessTask`. | ||
| 381 | - | ||
| 382 | -## [2.4.2] — 2018-05-07 | ||
| 383 | -- [Added] Implement ability to provide `UIBackgroundFetchResult` to `#finish` rather than hard-coded `UIBackgroundFetchResultNewData` | ||
| 384 | - | ||
| 385 | -## [2.4.1] — 2018-03-18 | ||
| 386 | -- [Fixed] react-native link was broken for iOS due to unused aggregate target. Remove unused targets. | ||
| 387 | - | ||
| 388 | -## [2.4.0] — 2018-02-27 | ||
| 389 | -- [Changed] The Android library `tsbackgroundfetch.aar` has be composed as a *Maven* repository. The installation procedure has changed slightly now and `flatDirs` has been replaced with a `maven url`. See the corresponding installation docs for more information. | ||
| 390 | -- [Changed] Android will check for *application-wide configuration properties* `buildSdkVersion`, `buildToolsVersion`, `targetSdkVersion`. See the Wiki "Solving Android Gradle Conflicts" for more information. | ||
| 391 | - | ||
| 392 | -## [2.3.0] — 2018-01-22 | ||
| 393 | -- [Added] Android implementation using `JobScheduler` / `AlarmManager` | ||
| 394 | - | ||
| @@ -0,0 +1,11 @@ | |||
| 1 | +## Committers列表 | ||
| 2 | + | ||
| 3 | +### 以下是此项目的committer人员 | ||
| 4 | + | ||
| 5 | +不区分先后顺序 | ||
| 6 | + | ||
| 7 | +- [MaDiXin](https://gitee.com/MaDiXin) | ||
| 8 | +- [xiafeng_xf_admin](https://gitee.com/xiafeng_xf_admin) | ||
| 9 | +- [ChenLixi](https://gitee.com/Louis-C7) | ||
| 10 | +- [LinJiacheng](https://gitee.com/LLLLLLin) | ||
| 11 | +- [ZhengJinshou](https://gitee.com/longziz) | ||
| @@ -1,43 +0,0 @@ | |||
| 1 | -<!-- | ||
| 2 | -# # # ###### # # ### # # ##### | ||
| 3 | -# # # # # # # ## # # ## # # # | ||
| 4 | -# # # # # # # # # # # # # # # | ||
| 5 | -# # # # # ###### # # # # # # # # #### | ||
| 6 | -# # # ####### # # # # # # # # # # # | ||
| 7 | -# # # # # # # # ## # # ## # # | ||
| 8 | - ## ## # # # # # # ### # # ##### | ||
| 9 | -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 10 | -!! WARNING: If you ignore this template, so too will your issue | ||
| 11 | -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!--> | ||
| 12 | - | ||
| 13 | -<!-- Provide a general summary of the issue in the Title above --> | ||
| 14 | - | ||
| 15 | -## Your Environment | ||
| 16 | -* Plugin version: | ||
| 17 | -* Platform: iOS or Android | ||
| 18 | -* OS version: | ||
| 19 | -* Device manufacturer / model: | ||
| 20 | -* React Native version (`react-native -v`): | ||
| 21 | -* Plugin config | ||
| 22 | - | ||
| 23 | -## Expected Behavior | ||
| 24 | -<!--- Tell us what should happen --> | ||
| 25 | - | ||
| 26 | -## Actual Behavior | ||
| 27 | -<!--- Tell us what happens instead --> | ||
| 28 | - | ||
| 29 | -## Steps to Reproduce | ||
| 30 | -<!--- Reproduce this issue; include code to reproduce, if relevant --> | ||
| 31 | -1. | ||
| 32 | -2. | ||
| 33 | -3. | ||
| 34 | -4. | ||
| 35 | - | ||
| 36 | -## Context | ||
| 37 | -<!--- What were you trying to do? --> | ||
| 38 | - | ||
| 39 | -## Debug logs | ||
| 40 | -<!-- | ||
| 41 | -include iOS / Android logs | ||
| 42 | -- iOS: XCode logs, | ||
| 43 | -- Android: $ adb logcat --> | ||
| @@ -0,0 +1,67 @@ | |||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<!-- Copyright (c) 2021 Huawei Device Co., Ltd. | ||
| 3 | + Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | + you may not use this file except in compliance with the License. | ||
| 5 | + You may obtain a copy of the License at | ||
| 6 | + http://www.apache.org/licenses/LICENSE-2.0 | ||
| 7 | + Unless required by applicable law or agreed to in writing, software | ||
| 8 | + distributed under the License is distributed on an "AS IS" BASIS, | ||
| 9 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 10 | + See the License for the specific language governing permissions and | ||
| 11 | + limitations under the License. | ||
| 12 | + This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README. | ||
| 13 | +--> | ||
| 14 | + | ||
| 15 | +<configuration> | ||
| 16 | + <oatconfig> | ||
| 17 | + <licensefile>LICENSE</licensefile> | ||
| 18 | + <policylist> | ||
| 19 | + <policy name="projectPolicy" desc=""> | ||
| 20 | + <policyitem type="license" name="MIT" path=".*" desc="license under the MIT"/> | ||
| 21 | + </policy> | ||
| 22 | + <policy name="projectPolicy" desc=""> | ||
| 23 | + <policyitem type="compatibility" name="GPL-2.0+" path=".*" desc="Process that runs independently, invoked by the X process."/> | ||
| 24 | + <policyitem type="compatibility" name="Apache-2.0" path=".*" desc="不影响兼容性"/> | ||
| 25 | + <policyitem type="compatibility" name="BSDStyleLicense" path=".*" desc="不影响兼容性" /> | ||
| 26 | + <policyitem type="compatibility" name="MIT" path=".*" desc="不影响兼容性" /> | ||
| 27 | + <policyitem type="compatibility" name="GPLStyleLicense" path=".*" desc="不影响兼容性" /> | ||
| 28 | + </policy> | ||
| 29 | + </policylist> | ||
| 30 | + <filefilterlist> | ||
| 31 | + <filefilter name="defaultFilter" desc="Files not to check"> | ||
| 32 | + | ||
| 33 | + </filefilter> | ||
| 34 | + <filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies"> | ||
| 35 | + <filteritem type="filename" name=".yarnignore" desc="工程配置文件,不添加版权头"/> | ||
| 36 | + <filteritem type="filename" name="LICENSE" desc="许可证说明文件,不添加版权头"/> | ||
| 37 | + <filteritem type="filename" name="RNBackgroundFetch.podspec" desc="工程配置文件,不添加版权头"/> | ||
| 38 | + <filteritem type="filename" name="app.plugin.js" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 39 | + <filteritem type="filename" name="README.OpenSource" desc="许可证说明文件,不添加版权头"/> | ||
| 40 | + <filteritem type="filepath" name="harmony/background_fetch/src/main/module.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 41 | + <filteritem type="filepath" name="harmony/background_fetch/BuildProfile.ets" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 42 | + <filteritem type="filepath" name="harmony/background_fetch/build-profile.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 43 | + <filteritem type="filepath" name="harmony/background_fetch/hvigorfile.ts" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 44 | + <filteritem type="filepath" name="harmony/background_fetch/oh-package-lock.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 45 | + <filteritem type="filepath" name="harmony/background_fetch/oh-package.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 46 | + | ||
| 47 | + </filefilter> | ||
| 48 | + <filefilter name="binaryFileTypePolicyFilter" desc="Filters for copyright header policies"> | ||
| 49 | + <filteritem type="filepath" name="harmony/background_fetch.har" desc="项目打包文件"/> | ||
| 50 | + </filefilter> | ||
| 51 | + | ||
| 52 | + <filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies"> | ||
| 53 | + <filteritem type="filename" name=".yarnignore" desc="工程配置文件,不添加版权头"/> | ||
| 54 | + <filteritem type="filename" name="RNBackgroundFetch.podspec" desc="工程配置文件,不添加版权头"/> | ||
| 55 | + <filteritem type="filename" name="app.plugin.js" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 56 | + <filteritem type="filename" name="README.OpenSource" desc="许可证说明文件,不添加版权头"/> | ||
| 57 | + <filteritem type="filepath" name="harmony/background_fetch/src/main/module.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 58 | + <filteritem type="filepath" name="harmony/background_fetch/BuildProfile.ets" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 59 | + <filteritem type="filepath" name="harmony/background_fetch/build-profile.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 60 | + <filteritem type="filepath" name="harmony/background_fetch/hvigorfile.ts" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 61 | + <filteritem type="filepath" name="harmony/background_fetch/oh-package-lock.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 62 | + <filteritem type="filepath" name="harmony/background_fetch/oh-package.json5" desc="工程配置文件,非业务代码,不添加许可证头"/> | ||
| 63 | + | ||
| 64 | + </filefilter> | ||
| 65 | + </filefilterlist> | ||
| 66 | + </oatconfig> | ||
| 67 | +</configuration> | ||
| @@ -0,0 +1,11 @@ | |||
| 1 | +[ | ||
| 2 | + { | ||
| 3 | + "Name": "react-native-background-fetch", | ||
| 4 | + "License": "MIT License", | ||
| 5 | + "License File": "https://github.com/transistorsoft/react-native-background-fetch/blob/master/LICENSE", | ||
| 6 | + "Version Number": "4.2.5", | ||
| 7 | + "Owner" : "xiafeng@huawei.com", | ||
| 8 | + "Upstream URL": "https://github.com/transistorsoft/react-native-background-fetch", | ||
| 9 | + "Description": "iOS & Android BackgroundFetch API implementation for React Native" | ||
| 10 | + } | ||
| 11 | +] | ||
| @@ -1,502 +1,13 @@ | |||
| 1 | -| <img src="https://dl.dropbox.com/s/gxl3sr8znhkrtah/expo-logo.png?dl=1" alt="alt text" width="32" /> | Now with *Expo* support | | 1 | +# @react-native-oh-tpl/react-native-background-fetch |
| 2 | -| --- | --- | | ||
| 3 | 2 | ||
| 4 | -react-native-background-fetch · []() []() | 3 | +This project is based on [react-native-background-fetch](https://github.com/transistorsoft/react-native-background-fetch) |
| 5 | -============================================================================== | ||
| 6 | 4 | ||
| 7 | -[](https://www.transistorsoft.com) | 5 | +## Documentation |
| 8 | 6 | ||
| 9 | -By [**Transistor Software**](http://transistorsoft.com), creators of [**React Native Background Geolocation**](http://www.transistorsoft.com/shop/products/react-native-background-geolocation) | 7 | +[中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-background-fetch.md) |
| 10 | 8 | ||
| 11 | ------------------------------------------------------------------------------- | 9 | +[English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-background-fetch.md) |
| 12 | 10 | ||
| 13 | -Background Fetch is a *very* simple plugin which attempts to awaken an app in the background about **every 15 minutes**, providing a short period of background running-time. This plugin will execute your provided `callbackFn` whenever a background-fetch event occurs. | 11 | +## License |
| 14 | 12 | ||
| 15 | -There is **no way** to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible — you will **never** receive an event faster than **15 minutes**. The operating-system will automatically throttle the rate the background-fetch events occur based upon usage patterns. Eg: if user hasn't turned on their phone for a long period of time, fetch events will occur less frequently or if an iOS user disables background refresh they may not happen at all. | 13 | +This project is based on [MIT License (MIT)](https://github.com/transistorsoft/react-native-background-fetch/blob/master/LICENSE) |
| 16 | - | ||
| 17 | -:new: Background Fetch now provides a [__`scheduleTask`__](#executing-custom-tasks) method for scheduling arbitrary "one-shot" or periodic tasks. | ||
| 18 | - | ||
| 19 | -### iOS | ||
| 20 | -- There is **no way** to increase the rate which a fetch-event occurs and this plugin sets the rate to the most frequent possible — you will **never** receive an event faster than **15 minutes**. The operating-system will automatically throttle the rate the background-fetch events occur based upon usage patterns. Eg: if user hasn't turned on their phone for a long period of time, fetch events will occur less frequently. | ||
| 21 | -- [__`scheduleTask`__](#executing-custom-tasks) seems only to fire when the device is plugged into power. | ||
| 22 | -- ⚠️ When your app is **terminated**, iOS *no longer fires events* — There is *no such thing* as **`stopOnTerminate: false`** for iOS. | ||
| 23 | -- iOS can take *days* before Apple's machine-learning algorithm settles in and begins regularly firing events. Do not sit staring at your logs waiting for an event to fire. If your [*simulated events*](#debugging) work, that's all you need to know that everything is correctly configured. | ||
| 24 | -- If the user doesn't open your *iOS* app for long periods of time, *iOS* will **stop firing events**. | ||
| 25 | - | ||
| 26 | -### Android | ||
| 27 | -- The Android plugin provides a [HeadlessJS](https://reactnative.dev/docs/headless-js-android) implementation allowing you to continue handling events even after app-termination (see **[`@config enableHeadless`](#config-boolean-enableheadless-false)**) | ||
| 28 | - | ||
| 29 | -------------------------------------------------------------- | ||
| 30 | - | ||
| 31 | -# Contents | ||
| 32 | -- ### :books: [API Documentation](#api-documentation) | ||
| 33 | - - [Config](#config) | ||
| 34 | - - [Methods](#methods) | ||
| 35 | -- ### [Installing the Plugin](#installing-the-plugin) | ||
| 36 | -- ### [Setup Guides](#setup-guides) | ||
| 37 | - - [iOS Setup](#ios-setup) | ||
| 38 | - - [Android Setup](#android-setup) | ||
| 39 | -- ### [Example](#example) | ||
| 40 | -- ### [Debugging](#debugging) | ||
| 41 | - | ||
| 42 | -------------------------------------------------------------- | ||
| 43 | - | ||
| 44 | -## Installing the plugin | ||
| 45 | - | ||
| 46 | -### With *Expo* | ||
| 47 | - | ||
| 48 | -```bash | ||
| 49 | -$ npx expo install react-native-background-fetch | ||
| 50 | -``` | ||
| 51 | - | ||
| 52 | -### With `yarn` | ||
| 53 | - | ||
| 54 | -```bash | ||
| 55 | -$ yarn add react-native-background-fetch | ||
| 56 | -``` | ||
| 57 | - | ||
| 58 | -### With `npm` | ||
| 59 | -```bash | ||
| 60 | -$ npm install --save react-native-background-fetch | ||
| 61 | -``` | ||
| 62 | - | ||
| 63 | -## Setup Guides | ||
| 64 | - | ||
| 65 | -### *Expo* Setup | ||
| 66 | - | ||
| 67 | -- [Expo Setup](docs/INSTALL-EXPO.md) | ||
| 68 | - | ||
| 69 | -### iOS Setup | ||
| 70 | - | ||
| 71 | -- [Auto-linking Setup](docs/INSTALL-AUTO-IOS.md) | ||
| 72 | - | ||
| 73 | -### Android Setup | ||
| 74 | - | ||
| 75 | -- [Auto-linking Setup](docs/INSTALL-AUTO-ANDROID.md) | ||
| 76 | - | ||
| 77 | -## Example ## | ||
| 78 | - | ||
| 79 | -:information_source: This repo contains its own *Example App*. See [`/example`](./example/README.md) | ||
| 80 | - | ||
| 81 | -```javascript | ||
| 82 | -import React from 'react'; | ||
| 83 | -import { | ||
| 84 | - SafeAreaView, | ||
| 85 | - StyleSheet, | ||
| 86 | - ScrollView, | ||
| 87 | - View, | ||
| 88 | - Text, | ||
| 89 | - FlatList, | ||
| 90 | - StatusBar, | ||
| 91 | -} from 'react-native'; | ||
| 92 | - | ||
| 93 | -import { | ||
| 94 | - Header, | ||
| 95 | - Colors | ||
| 96 | -} from 'react-native/Libraries/NewAppScreen'; | ||
| 97 | - | ||
| 98 | -import BackgroundFetch from "react-native-background-fetch"; | ||
| 99 | - | ||
| 100 | -class App extends React.Component { | ||
| @@ -1,44 +0,0 @@ | |||
| 1 | -apply plugin: 'com.android.library' | ||
| 2 | - | ||
| 3 | -def DEFAULT_COMPILE_SDK_VERSION = 31 | ||
| 4 | -def DEFAULT_TARGET_SDK_VERSION = 30 | ||
| 5 | -def DEFAULT_MIN_SDK_VERSION = 16 | ||
| 6 | -def DEFAULT_LIFE_CYCLE_RUNTIME_VERSION = "2.4.1" | ||
| 7 | -def DEFAULT_LIFE_CYCLE_EXTENSIONS_VERSION = "2.2.0" | ||
| 8 | - | ||
| 9 | -def safeExtGet(prop, fallback) { | ||
| 10 | - rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback | ||
| 11 | -} | ||
| 12 | - | ||
| 13 | -android { | ||
| 14 | - if (project.android.hasProperty("namespace")) { | ||
| 15 | - namespace("com.transistorsoft.rnbackgroundfetch") | ||
| 16 | - } | ||
| 17 | - | ||
| 18 | - compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION) | ||
| 19 | - | ||
| 20 | - defaultConfig { | ||
| 21 | - minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION) | ||
| 22 | - targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION) | ||
| 23 | - versionCode 1 | ||
| 24 | - versionName "1.0" | ||
| 25 | - } | ||
| 26 | -} | ||
| 27 | - | ||
| 28 | -repositories{ | ||
| 29 | - mavenCentral() | ||
| 30 | - maven { | ||
| 31 | - url './libs' | ||
| 32 | - } | ||
| 33 | -} | ||
| 34 | - | ||
| 35 | -dependencies { | ||
| 36 | - def lifeCycleRuntimeVersion = safeExtGet('lifeCycleRuntimeVersion', DEFAULT_LIFE_CYCLE_RUNTIME_VERSION) | ||
| 37 | - def lifeCycleExtensionsVersion = safeExtGet('lifeCycleExtensionsVersion', DEFAULT_LIFE_CYCLE_EXTENSIONS_VERSION) | ||
| 38 | - | ||
| 39 | - implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}" | ||
| 40 | - implementation(group: 'com.transistorsoft', name:'tsbackgroundfetch', version: '+') | ||
| 41 | - // LifeCycleObserver | ||
| 42 | - implementation "androidx.lifecycle:lifecycle-runtime:$lifeCycleRuntimeVersion" | ||
| 43 | - implementation "androidx.lifecycle:lifecycle-extensions:$lifeCycleExtensionsVersion" | ||
| 44 | -} | ||
Binary files do not support preview
| @@ -1 +0,0 @@ | |||
| 1 | -98e3cce1a636b43ee4efdbee7bf3e1a8 | ||
| @@ -1 +0,0 @@ | |||
| 1 | -d5a18accfe66cd0374cbf3a0c17a88fc81ec0085 | ||
| @@ -1 +0,0 @@ | |||
| 1 | -299db64e6d7eec8aceb051f988421cd3ac9081eb0a5039b97df72a318c50def2 | ||
| @@ -1 +0,0 @@ | |||
| 1 | -1d08ea3553e23225fa82c909b88f98d805ef2010e093d6c23e08b6f002945ad806a467bad3b0d0433f3e3994e0837f542883f3f6597d44ee826caf043d277ef0 | ||
| @@ -1,9 +0,0 @@ | |||
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| 4 | - <modelVersion>4.0.0</modelVersion> | ||
| 5 | - <groupId>com.transistorsoft</groupId> | ||
| 6 | - <artifactId>tsbackgroundfetch</artifactId> | ||
| 7 | - <version>1.0.2</version> | ||
| 8 | - <packaging>aar</packaging> | ||
| 9 | -</project> | ||
| @@ -1 +0,0 @@ | |||
| 1 | -0856eeec9ad640c46aff20e6a51d4aed | ||
| @@ -1 +0,0 @@ | |||
| 1 | -b498fbfab494be93fd6f090d2f3a5209f8d2f8f6 | ||
| @@ -1 +0,0 @@ | |||
| 1 | -46d6a13cfa1a043f20d50994a7ed2112111fdef52a74be6d1c2ae61bcc351ac3 | ||
| @@ -1 +0,0 @@ | |||
| 1 | -c73ac140afdbb06bf4ed2f4d51da2740868c391c3adc2428c33b9d45a7612610a81b887d25a179aa1d91170084320ad4ad12c0dcd97e935a6080f47b9d23f7e9 | ||
| @@ -1,14 +0,0 @@ | |||
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<metadata> | ||
| 3 | - <groupId>com.transistorsoft</groupId> | ||
| 4 | - <artifactId>tsbackgroundfetch</artifactId> | ||
| 5 | - <versioning> | ||
| 6 | - <latest>1.0.2</latest> | ||
| 7 | - <release>1.0.2</release> | ||
| 8 | - <versions> | ||
| 9 | - <version>1.0.1</version> | ||
| 10 | - <version>1.0.2</version> | ||
| 11 | - </versions> | ||
| 12 | - <lastUpdated>20230820223945</lastUpdated> | ||
| 13 | - </versioning> | ||
| 14 | -</metadata> | ||
| @@ -1,2 +0,0 @@ | |||
| 1 | -# [react-native-background-fetch] | ||
| 2 | --keep class com.transistorsoft.rnbackgroundfetch.HeadlessTask { *; } | ||
| @@ -1,8 +0,0 @@ | |||
| 1 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 2 | - package="com.transistorsoft.rnbackgroundfetch"> | ||
| 3 | - | ||
| 4 | - <application> | ||
| 5 | - | ||
| 6 | - </application> | ||
| 7 | - | ||
| 8 | -</manifest> | ||
| @@ -1,119 +0,0 @@ | |||
| 1 | -package com.transistorsoft.rnbackgroundfetch; | ||
| 2 | - | ||
| 3 | -import android.content.Context; | ||
| 4 | -import android.os.Handler; | ||
| 5 | -import android.util.Log; | ||
| 6 | - | ||
| 7 | -import com.facebook.react.ReactApplication; | ||
| 8 | -import com.facebook.react.ReactInstanceManager; | ||
| 9 | -import com.facebook.react.ReactNativeHost; | ||
| 10 | -import com.facebook.react.bridge.ReactContext; | ||
| 11 | -import com.facebook.react.bridge.UiThreadUtil; | ||
| 12 | -import com.facebook.react.bridge.WritableMap; | ||
| 13 | -import com.facebook.react.bridge.WritableNativeMap; | ||
| 14 | -import com.facebook.react.jstasks.HeadlessJsTaskConfig; | ||
| 15 | -import com.facebook.react.jstasks.HeadlessJsTaskContext; | ||
| 16 | -import com.facebook.react.jstasks.HeadlessJsTaskEventListener; | ||
| 17 | -import com.transistorsoft.tsbackgroundfetch.BGTask; | ||
| 18 | -import com.transistorsoft.tsbackgroundfetch.BackgroundFetch; | ||
| 19 | -import com.facebook.react.common.LifecycleState; | ||
| 20 | - | ||
| 21 | -/** | ||
| 22 | - * Created by chris on 2018-01-17. | ||
| 23 | - */ | ||
| 24 | - | ||
| 25 | -public class HeadlessTask implements HeadlessJsTaskEventListener { | ||
| 26 | - private static String HEADLESS_TASK_NAME = "BackgroundFetch"; | ||
| 27 | - private static Handler mHandler = new Handler(); | ||
| 28 | - private ReactNativeHost mReactNativeHost; | ||
| 29 | - private HeadlessJsTaskContext mActiveTaskContext; | ||
| 30 | - | ||
| 31 | - public HeadlessTask(Context context, BGTask task) { | ||
| 32 | - try { | ||
| 33 | - ReactApplication reactApplication = ((ReactApplication) context.getApplicationContext()); | ||
| 34 | - mReactNativeHost = reactApplication.getReactNativeHost(); | ||
| 35 | - } catch (AssertionError | ClassCastException e) { | ||
| 36 | - Log.e(BackgroundFetch.TAG, "Failed to fetch ReactApplication. Task ignored."); | ||
| 37 | - return; // <-- Do nothing. Just return | ||
| 38 | - } | ||
| 39 | - WritableMap clientEvent = new WritableNativeMap(); | ||
| 40 | - clientEvent.putString("taskId", task.getTaskId()); | ||
| 41 | - clientEvent.putBoolean("timeout", task.getTimedOut()); | ||
| 42 | - HeadlessJsTaskConfig config = new HeadlessJsTaskConfig(HEADLESS_TASK_NAME, clientEvent, 30000); | ||
| 43 | - startTask(config); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | - public void finish() { | ||
| 47 | - if (mActiveTaskContext != null) { | ||
| 48 | - mActiveTaskContext.removeTaskEventListener(this); | ||
| 49 | - } | ||
| 50 | - } | ||
| 51 | - @Override | ||
| 52 | - public void onHeadlessJsTaskStart(int taskId) { | ||
| 53 | - Log.d(BackgroundFetch.TAG,"onHeadlessJsTaskStart: " + taskId); | ||
| 54 | - } | ||
| 55 | - @Override | ||
| 56 | - public void onHeadlessJsTaskFinish(int taskId) { | ||
| 57 | - Log.d(BackgroundFetch.TAG, "onHeadlessJsTaskFinish: " + taskId); | ||
| 58 | - mActiveTaskContext.removeTaskEventListener(this); | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - /** | ||
| 62 | - * Start a task. This method handles starting a new React instance if required. | ||
| 63 | - * | ||
| 64 | - * Has to be called on the UI thread. | ||
| 65 | - * | ||
| 66 | - * @param taskConfig describes what task to start and the parameters to pass to it | ||
| 67 | - */ | ||
| 68 | - protected void startTask(final HeadlessJsTaskConfig taskConfig) { | ||
| 69 | - UiThreadUtil.assertOnUiThread(); | ||
| 70 | - final ReactInstanceManager reactInstanceManager = mReactNativeHost.getReactInstanceManager(); | ||
| 71 | - ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); | ||
| 72 | - if (reactContext == null) { | ||
| 73 | - reactInstanceManager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() { | ||
| 74 | - @Override | ||
| 75 | - public void onReactContextInitialized(final ReactContext reactContext) { | ||
| 76 | - // Hack to fix unknown problem executing asynchronous BackgroundTask when ReactContext is created *first time*. Fixed by adding short delay before #invokeStartTask | ||
| 77 | - mHandler.postDelayed(new Runnable() { | ||
| 78 | - @Override | ||
| 79 | - public void run() { | ||
| 80 | - invokeStartTask(reactContext, taskConfig); | ||
| 81 | - } | ||
| 82 | - }, 500); | ||
| 83 | - reactInstanceManager.removeReactInstanceEventListener(this); | ||
| 84 | - } | ||
| 85 | - }); | ||
| 86 | - if (!reactInstanceManager.hasStartedCreatingInitialContext()) { | ||
| 87 | - reactInstanceManager.createReactContextInBackground(); | ||
| 88 | - } | ||
| 89 | - } else { | ||
| 90 | - invokeStartTask(reactContext, taskConfig); | ||
| 91 | - } | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - private void invokeStartTask(ReactContext reactContext, final HeadlessJsTaskConfig taskConfig) { | ||
| 95 | - if (reactContext.getLifecycleState() == LifecycleState.RESUMED) { | ||
| 96 | - return; | ||
| 97 | - } | ||
| 98 | - final HeadlessJsTaskContext headlessJsTaskContext = HeadlessJsTaskContext.getInstance(reactContext); | ||
| 99 | - headlessJsTaskContext.addTaskEventListener(this); | ||
| 100 | - mActiveTaskContext = headlessJsTaskContext; | ||
| 101 | - try { | ||
| 102 | - UiThreadUtil.runOnUiThread(new Runnable() { | ||
| 103 | - @Override | ||
| 104 | - public void run() { | ||
| 105 | - try { | ||
| 106 | - int taskId = headlessJsTaskContext.startTask(taskConfig); | ||
| 107 | - } catch (IllegalStateException exception) { | ||
| 108 | - Log.e(BackgroundFetch.TAG, "Headless task attempted to run in the foreground. Task ignored."); | ||
| 109 | - return; // <-- Do nothing. Just return | ||
| 110 | - } | ||
| 111 | - } | ||
| 112 | - }); | ||
| 113 | - } catch (IllegalStateException exception) { | ||
| 114 | - Log.e(BackgroundFetch.TAG, "Headless task attempted to run in the foreground. Task ignored."); | ||
| 115 | - return; // <-- Do nothing. Just return | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - } | ||
| 119 | -} | ||
| @@ -1,185 +0,0 @@ | |||
| 1 | -package com.transistorsoft.rnbackgroundfetch; | ||
| 2 | - | ||
| 3 | -import android.app.Activity; | ||
| 4 | -import android.content.Intent; | ||
| 5 | -import android.util.Log; | ||
| 6 | - | ||
| 7 | -import com.facebook.react.bridge.*; | ||
| 8 | -import com.facebook.react.modules.core.RCTNativeAppEventEmitter; | ||
| 9 | -import com.transistorsoft.tsbackgroundfetch.BackgroundFetch; | ||
| 10 | -import com.transistorsoft.tsbackgroundfetch.BackgroundFetchConfig; | ||
| 11 | -import com.transistorsoft.tsbackgroundfetch.LifecycleManager; | ||
| 12 | - | ||
| 13 | -public class RNBackgroundFetchModule extends ReactContextBaseJavaModule implements ActivityEventListener, LifecycleEventListener { | ||
| 14 | - public static final String TAG = "RNBackgroundFetch"; | ||
| 15 | - private static final String EVENT_FETCH = "fetch"; | ||
| 16 | - private static final String JOB_SERVICE_CLASS = HeadlessTask.class.getName(); | ||
| 17 | - private static final String FETCH_TASK_ID = "react-native-background-fetch"; | ||
| 18 | - private boolean initialized = false; | ||
| 19 | - | ||
| 20 | - public RNBackgroundFetchModule(ReactApplicationContext reactContext) { | ||
| 21 | - super(reactContext); | ||
| 22 | - Log.d(BackgroundFetch.TAG, "[RNBackgroundFetch initialize]"); | ||
| 23 | - BackgroundFetch.getInstance(reactContext.getApplicationContext()); | ||
| 24 | - reactContext.addLifecycleEventListener(this); | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - @Override | ||
| 28 | - public String getName() { | ||
| 29 | - return TAG; | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - @ReactMethod | ||
| 33 | - public void configure(ReadableMap options, final Callback success, final Callback failure) { | ||
| 34 | - BackgroundFetch adapter = getAdapter(); | ||
| 35 | - | ||
| 36 | - BackgroundFetch.Callback callback = new BackgroundFetch.Callback() { | ||
| 37 | - @Override public void onFetch(String taskId) { | ||
| 38 | - WritableMap params = new WritableNativeMap(); | ||
| 39 | - params.putString("taskId", taskId); | ||
| 40 | - params.putBoolean("timeout", false); | ||
| 41 | - getReactApplicationContext().getJSModule(RCTNativeAppEventEmitter.class).emit(EVENT_FETCH, params); | ||
| 42 | - } | ||
| 43 | - @Override public void onTimeout(String taskId) { | ||
| 44 | - WritableMap params = new WritableNativeMap(); | ||
| 45 | - params.putString("taskId", taskId); | ||
| 46 | - params.putBoolean("timeout", true); | ||
| 47 | - getReactApplicationContext().getJSModule(RCTNativeAppEventEmitter.class).emit(EVENT_FETCH, params); | ||
| 48 | - } | ||
| 49 | - }; | ||
| 50 | - adapter.configure(buildConfig(options) | ||
| 51 | - .setTaskId(FETCH_TASK_ID) | ||
| 52 | - .setIsFetchTask(true) | ||
| 53 | - .build(), callback); | ||
| 54 | - | ||
| 55 | - success.invoke(BackgroundFetch.STATUS_AVAILABLE); | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - @ReactMethod | ||
| 59 | - public void scheduleTask(ReadableMap options, final Callback success, final Callback failure) { | ||
| 60 | - BackgroundFetch adapter = getAdapter(); | ||
| 61 | - adapter.scheduleTask(buildConfig(options).build()); | ||
| 62 | - success.invoke(true); | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - @ReactMethod | ||
| 66 | - public void start(Callback success, Callback failure) { | ||
| 67 | - BackgroundFetch adapter = getAdapter(); | ||
| 68 | - adapter.start(FETCH_TASK_ID); | ||
| 69 | - success.invoke(adapter.status()); | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | - @ReactMethod | ||
| 73 | - public void stop(String taskId, Callback success, Callback failure) { | ||
| 74 | - if (taskId == null) taskId = FETCH_TASK_ID; | ||
| 75 | - BackgroundFetch adapter = getAdapter(); | ||
| 76 | - adapter.stop(taskId); | ||
| 77 | - success.invoke(true); | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - @ReactMethod | ||
| 81 | - public void status(Callback success) { | ||
| 82 | - BackgroundFetch adapter = getAdapter(); | ||
| 83 | - success.invoke(adapter.status()); | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - @ReactMethod | ||
| 87 | - public void finish(String taskId) { | ||
| 88 | - BackgroundFetch adapter = getAdapter(); | ||
| 89 | - adapter.finish(taskId); | ||
| 90 | - } | ||
| 91 | - | ||
| 92 | - @ReactMethod | ||
| 93 | - public void addListener(String event) { | ||
| 94 | - // Keep: Required for RN built-in NativeEventEmitter calls. | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - @ReactMethod | ||
| 98 | - public void removeListeners(Integer count) { | ||
| 99 | - // Keep: Required for RN built-in NativeEventEmitter calls. | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | - @Override | ||
| 103 | - public void onHostResume() { | ||
| 104 | - if (!initialized) { | ||
| 105 | - initializeBackgroundFetch(); | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - @Override | ||
| 110 | - public void onHostPause() { | ||
| 111 | - } | ||
| 112 | - | ||
| 113 | - @Override | ||
| 114 | - public void onNewIntent(Intent intent) { | ||
| 115 | - } | ||
| 116 | - | ||
| 117 | - @Override | ||
| 118 | - public void onHostDestroy() { | ||
| 119 | - LifecycleManager.getInstance().setHeadless(true); | ||
| 120 | - initialized = false; | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - @Override | ||
| 124 | - public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { | ||
| 125 | - | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - private BackgroundFetchConfig.Builder buildConfig(ReadableMap options) { | ||
| 129 | - BackgroundFetchConfig.Builder config = new BackgroundFetchConfig.Builder(); | ||
| 130 | - if (options.hasKey(BackgroundFetchConfig.FIELD_MINIMUM_FETCH_INTERVAL)) { | ||
| 131 | - config.setMinimumFetchInterval(options.getInt(BackgroundFetchConfig.FIELD_MINIMUM_FETCH_INTERVAL)); | ||
| 132 | - } | ||
| 133 | - if (options.hasKey(BackgroundFetchConfig.FIELD_TASK_ID)) { | ||
| 134 | - config.setTaskId(options.getString(BackgroundFetchConfig.FIELD_TASK_ID)); | ||
| 135 | - } | ||
| 136 | - if (options.hasKey(BackgroundFetchConfig.FIELD_DELAY)) { | ||
| 137 | - Integer delay = options.getInt(BackgroundFetchConfig.FIELD_DELAY); | ||
| 138 | - config.setDelay(delay.longValue()); | ||
| 139 | - } | ||
| 140 | - if (options.hasKey(BackgroundFetchConfig.FIELD_STOP_ON_TERMINATE)) { | ||
| 141 | - config.setStopOnTerminate(options.getBoolean(BackgroundFetchConfig.FIELD_STOP_ON_TERMINATE)); | ||
| 142 | - } | ||
| 143 | - if (options.hasKey(BackgroundFetchConfig.FIELD_FORCE_ALARM_MANAGER)) { | ||
| 144 | - config.setForceAlarmManager(options.getBoolean(BackgroundFetchConfig.FIELD_FORCE_ALARM_MANAGER)); | ||
| 145 | - } | ||
| 146 | - if (options.hasKey(BackgroundFetchConfig.FIELD_START_ON_BOOT)) { | ||
| 147 | - config.setStartOnBoot(options.getBoolean(BackgroundFetchConfig.FIELD_START_ON_BOOT)); | ||
| 148 | - } | ||
| 149 | - if (options.hasKey("enableHeadless") && options.getBoolean("enableHeadless")) { | ||
| 150 | - config.setJobService(JOB_SERVICE_CLASS); | ||
| 151 | - } | ||
| 152 | - if (options.hasKey(BackgroundFetchConfig.FIELD_REQUIRED_NETWORK_TYPE)) { | ||
| 153 | - config.setRequiredNetworkType(options.getInt(BackgroundFetchConfig.FIELD_REQUIRED_NETWORK_TYPE)); | ||
| 154 | - } | ||
| 155 | - if (options.hasKey(BackgroundFetchConfig.FIELD_REQUIRES_BATTERY_NOT_LOW)) { | ||
| 156 | - config.setRequiresBatteryNotLow(options.getBoolean(BackgroundFetchConfig.FIELD_REQUIRES_BATTERY_NOT_LOW)); | ||
| 157 | - } | ||
| 158 | - if (options.hasKey(BackgroundFetchConfig.FIELD_REQUIRES_CHARGING)) { | ||
| 159 | - config.setRequiresCharging(options.getBoolean(BackgroundFetchConfig.FIELD_REQUIRES_CHARGING)); | ||
| 160 | - } | ||
| 161 | - if (options.hasKey(BackgroundFetchConfig.FIELD_REQUIRES_DEVICE_IDLE)) { | ||
| 162 | - config.setRequiresDeviceIdle(options.getBoolean(BackgroundFetchConfig.FIELD_REQUIRES_DEVICE_IDLE)); | ||
| 163 | - } | ||
| 164 | - if (options.hasKey(BackgroundFetchConfig.FIELD_REQUIRES_STORAGE_NOT_LOW)) { | ||
| 165 | - config.setRequiresStorageNotLow(options.getBoolean(BackgroundFetchConfig.FIELD_REQUIRES_STORAGE_NOT_LOW)); | ||
| 166 | - } | ||
| 167 | - if (options.hasKey(BackgroundFetchConfig.FIELD_PERIODIC)) { | ||
| 168 | - config.setPeriodic(options.getBoolean(BackgroundFetchConfig.FIELD_PERIODIC)); | ||
| 169 | - } | ||
| 170 | - return config; | ||
| 171 | - } | ||
| 172 | - | ||
| 173 | - private void initializeBackgroundFetch() { | ||
| 174 | - Activity activity = getCurrentActivity(); | ||
| 175 | - if (activity == null) { | ||
| 176 | - return; | ||
| 177 | - } | ||
| 178 | - initialized = true; | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - private BackgroundFetch getAdapter() { | ||
| 182 | - return BackgroundFetch.getInstance(getReactApplicationContext()); | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | -} | ||
| @@ -1,29 +0,0 @@ | |||
| 1 | -package com.transistorsoft.rnbackgroundfetch; | ||
| 2 | - | ||
| 3 | -import com.facebook.react.ReactPackage; | ||
| 4 | -import com.facebook.react.bridge.JavaScriptModule; | ||
| 5 | -import com.facebook.react.bridge.NativeModule; | ||
| 6 | -import com.facebook.react.bridge.ReactApplicationContext; | ||
| 7 | -import com.facebook.react.uimanager.ViewManager; | ||
| 8 | - | ||
| 9 | -import java.util.ArrayList; | ||
| 10 | -import java.util.Collections; | ||
| 11 | -import java.util.List; | ||
| 12 | - | ||
| 13 | -public class RNBackgroundFetchPackage implements ReactPackage { | ||
| 14 | - @Override | ||
| 15 | - public List<NativeModule> createNativeModules (ReactApplicationContext reactContext) { | ||
| 16 | - List<NativeModule> modules = new ArrayList<>(); | ||
| 17 | - modules.add(new RNBackgroundFetchModule(reactContext)); | ||
| 18 | - return modules; | ||
| 19 | - } | ||
| 20 | - | ||
| 21 | - public List<Class<? extends JavaScriptModule>> createJSModules() { | ||
| 22 | - return Collections.emptyList(); | ||
| 23 | - } | ||
| 24 | - | ||
| 25 | - @Override | ||
| 26 | - public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
| 27 | - return Collections.emptyList(); | ||
| 28 | - } | ||
| 29 | -} | ||
| @@ -1,71 +0,0 @@ | |||
| 1 | -# Android Auto-linking Setup | ||
| 2 | - | ||
| 3 | -### `react-native >= 0.60` | ||
| 4 | - | ||
| 5 | -### With `yarn` | ||
| 6 | - | ||
| 7 | -```bash | ||
| 8 | -$ yarn add react-native-background-fetch | ||
| 9 | -``` | ||
| 10 | - | ||
| 11 | -### With `npm` | ||
| 12 | -```bash | ||
| 13 | -$ npm install --save react-native-background-fetch | ||
| 14 | -``` | ||
| 15 | - | ||
| 16 | -## Gradle Configuration | ||
| 17 | - | ||
| 18 | -The SDK requires a custom __`maven url`__ in the root __`android/build.gradle`__. | ||
| 19 | -Please note that some more recent versions of React Native the Android template may not include __`allprojects`__ section. You should add this manually as a separate section along with the nested __`repositories`__ section in the same __`android/build.gradle`__ file. | ||
| 20 | - | ||
| 21 | -### :open_file_folder: **`android/build.gradle`** | ||
| 22 | - | ||
| 23 | -```diff | ||
| 24 | -allprojects { | ||
| 25 | - repositories { | ||
| 26 | - mavenLocal() | ||
| 27 | - maven { | ||
| 28 | - // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | ||
| 29 | - url("$rootDir/../node_modules/react-native/android") | ||
| 30 | - } | ||
| 31 | - maven { | ||
| 32 | - // Android JSC is installed from npm | ||
| 33 | - url("$rootDir/../node_modules/jsc-android/dist") | ||
| 34 | - } | ||
| 35 | -+ maven { | ||
| 36 | -+ // react-native-background-fetch | ||
| 37 | -+ url("${project(':react-native-background-fetch').projectDir}/libs") | ||
| 38 | -+ } | ||
| 39 | - | ||
| 40 | - } | ||
| 41 | -} | ||
| 42 | -``` | ||
| 43 | - | ||
| 44 | -## Configure __`proguard-rules.pro`__ | ||
| 45 | - | ||
| 46 | -If you're using __`minifyEnabled true`__ with your Android release build, the plugin's __`HeadlessTask`__ class will be mistakenly *removed* and you will have [this crash](https://github.com/transistorsoft/react-native-background-fetch/issues/261). | ||
| 47 | - | ||
| 48 | -1. Edit `android/app/proguard-rules.pro`. | ||
| 49 | -2. Add the following rule: | ||
| 50 | - | ||
| 51 | -```bash | ||
| 52 | -# [react-native-background-fetch] | ||
| 53 | --keep class com.transistorsoft.rnbackgroundfetch.HeadlessTask { *; } | ||
| 54 | -``` | ||
| 55 | - | ||
| 56 | -## Precise event-scheduling with `forceAlarmManager: true`: | ||
| 57 | - | ||
| 58 | -**Only** If you wish to use precise scheduling of events with __`forceAlarmManager: true`__, *Android 14 (SDK 34)*, has restricted usage of ["`AlarmManager` exact alarms"](https://developer.android.com/about/versions/14/changes/schedule-exact-alarms). To continue using precise timing of events with *Android 14*, you can manually add this permission to your __`AndroidManifest`__. Otherwise, the plugin will gracefully fall-back to "*in-exact* `AlarmManager` scheduling": | ||
| 59 | - | ||
| 60 | -:open_file_folder: In your `AndroidManifest`, add the following permission (**exactly as-shown**): | ||
| 61 | - | ||
| 62 | -```xml | ||
| 63 | - <manifest> | ||
| 64 | - <uses-permission android:minSdkVersion="34" android:name="android.permission.USE_EXACT_ALARM" /> | ||
| 65 | - . | ||
| 66 | - . | ||
| 67 | - . | ||
| 68 | - </manifest> | ||
| 69 | -``` | ||
| 70 | -:warning: It has been announced that *Google Play Store* [has plans to impose greater scrutiny](https://support.google.com/googleplay/android-developer/answer/13161072?sjid=3640341614632608469-NA) over usage of this permission (which is why the plugin does not automatically add it). | ||
| 71 | - | ||
| @@ -1,178 +0,0 @@ | |||
| 1 | -# iOS Auto-linking Setup | ||
| 2 | -### `react-native >= 0.60` | ||
| 3 | - | ||
| 4 | -### With `yarn` | ||
| 5 | - | ||
| 6 | -```bash | ||
| 7 | -$ yarn add react-native-background-fetch | ||
| 8 | -``` | ||
| 9 | - | ||
| 10 | -### With `npm` | ||
| 11 | -```bash | ||
| 12 | -$ npm install --save react-native-background-fetch | ||
| 13 | -``` | ||
| 14 | - | ||
| 15 | -## `pod install` | ||
| 16 | - | ||
| 17 | -**:warning: requires *cocoapods* `>= 1.10+`:** | ||
| 18 | - | ||
| 19 | -```bash | ||
| 20 | -$ pod --version | ||
| 21 | -// if < 1.10.0 | ||
| 22 | -$ sudo gem install cocoapods | ||
| 23 | -``` | ||
| 24 | - | ||
| 25 | -```bash | ||
| 26 | -$ cd ios | ||
| 27 | -$ pod install | ||
| 28 | -``` | ||
| 29 | - | ||
| 30 | -## Configure Background Capabilities | ||
| 31 | - | ||
| 32 | -- Select the root of your project. Select **Capabilities** tab. Enable **Background Modes** and enable the following mode: | ||
| 33 | - | ||
| 34 | -- [x] Background fetch | ||
| 35 | -- [x] Background processing (:new: __iOS 13+__; Only if you intend to use `BackgroundFetch.scheduleTask`) | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | ||
| 39 | - | ||
| 40 | -## Configure `Info.plist` (:new: __iOS 13+__) | ||
| 41 | -1. Open your `Info.plist` and add the key *"Permitted background task scheduler identifiers"* | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | -2. Add the **required identifier `com.transistorsoft.fetch`**. | ||
| 46 | - | ||
| 47 | - | ||
| 48 | - | ||
| 49 | -3. If you intend to execute your own custom tasks via **`BackgroundFetch.scheduleTask`**, you must add those custom identifiers as well. For example, if you intend to execute a custom **`taskId: 'com.transistorsoft.customtask'`**, you must add the identifier **`com.transistorsoft.customtask`** to your *"Permitted background task scheduler identifiers"*, as well. | ||
| 50 | - | ||
| 51 | -:warning: A task identifier can be any string you wish, but it's a good idea to prefix them now with `com.transistorsoft.` — In the future, the `com.transistorsoft` prefix **may become required**. | ||
| 52 | - | ||
| 53 | -```javascript | ||
| 54 | -BackgroundFetch.scheduleTask({ | ||
| 55 | - taskId: 'com.transistorsoft.customtask', | ||
| 56 | - delay: 60 * 60 * 1000 // In one hour (milliseconds) | ||
| 57 | -}); | ||
| 58 | -``` | ||
| 59 | - | ||
| 60 | -## Privacy Manifest | ||
| 61 | - | ||
| 62 | -Apple now requires apps provide a [Privacy Manifest for "sensitive" APIs](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api?language=objc) which could be abused for "fingerprinting" a user for malicious marketing activity. | ||
| 63 | - | ||
| 64 | -If your app does not yet have a *Privacy Manifest* (__`PrivacyInfo.xcprivacy`__), create one now: | ||
| 65 | - | ||
| 66 | -<details> | ||
| 67 | - <summary>ℹ️ Click here for detailed instructions...</summary> | ||
| 68 | - | ||
| 69 | -- In XCode, __`File -> New -> File...`__: | ||
| 70 | - | ||
| 71 | - | ||
| 72 | - | ||
| 73 | -- Be sure to enable your `Targets: [x] YourApp`: | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - | ||
| 77 | - | ||
| 78 | -</details> | ||
| 79 | - | ||
| 80 | - | ||
| 81 | -It's best to edit this file's XML manually. | ||
| 82 | -- :open_file_folder: `ios/PrivacyInfo.xcprivacy` | ||
| 83 | -- Add the following block within the `NSPrivacyAccessedAPITypes` `<array>` container: | ||
| 84 | - | ||
| 85 | -```xml | ||
| 86 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 87 | -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 88 | - | ||
| 89 | -<plist version="1.0"> | ||
| 90 | -<dict> | ||
| 91 | - <key>NSPrivacyAccessedAPITypes</key> | ||
| 92 | - <array> | ||
| 93 | - <!-- [1] background_fetch: UserDefaults --> | ||
| 94 | - <dict> | ||
| 95 | - <key>NSPrivacyAccessedAPIType</key> | ||
| 96 | - <string>NSPrivacyAccessedAPICategoryUserDefaults</string> | ||
| 97 | - | ||
| 98 | - <key>NSPrivacyAccessedAPITypeReasons</key> | ||
| 99 | - <array> | ||
| 100 | - <string>CA92.1</string> | ||
| 101 | - </array> | ||
| 102 | - </dict> | ||
| 103 | - </array> | ||
| 104 | -</dict> | ||
| 105 | -</plist> | ||
| 106 | -``` | ||
| 107 | - | ||
| 108 | -## `AppDelegate` | ||
| 109 | -:open_file_folder: __`AppDelegate.m`__ | ||
| 110 | - | ||
| 111 | -```diff | ||
| 112 | -#import "AppDelegate.h" | ||
| 113 | - | ||
| 114 | -#import <React/RCTBridge.h> | ||
| 115 | -#import <React/RCTBundleURLProvider.h> | ||
| 116 | -#import <React/RCTRootView.h> | ||
| 117 | - | ||
| 118 | -// IMPORTANT: Paste import ABOVE the DEBUG macro | ||
| 119 | -+#import <TSBackgroundFetch/TSBackgroundFetch.h> | ||
| 120 | - | ||
| 121 | -#if DEBUG | ||
| 122 | -. | ||
| 123 | -. /////////////////////////////////////////////////////////////////////////////////// | ||
| 124 | -. // IMPORTANT: DO NOT paste import within DEBUG macro or archiving will fail!!! | ||
| 125 | -. /////////////////////////////////////////////////////////////////////////////////// | ||
| 126 | -. | ||
| 127 | -#endif | ||
| 128 | - | ||
| 129 | -@implementation AppDelegate | ||
| 130 | - | ||
| 131 | -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| 132 | - . | ||
| 133 | - . | ||
| 134 | - . | ||
| 135 | -+ // [REQUIRED] Register BackgroundFetch | ||
| 136 | -+ [[TSBackgroundFetch sharedInstance] didFinishLaunching]; | ||
| 137 | - | ||
| 138 | - return YES; | ||
| 139 | -} | ||
| 140 | -``` | ||
| 141 | - | ||
| 142 | -#### Or if you're using `Swift`: | ||
| 143 | -:open_file_folder: __`AppDelegate.swift`__: | ||
| 144 | - | ||
| 145 | -```diff | ||
| 146 | -import Foundation | ||
| 147 | -import UIKit | ||
| 148 | -+import TSBackgroundFetch | ||
| 149 | - | ||
| 150 | -@UIApplicationMain | ||
| 151 | -class AppDelegate: RCTAppDelegate { | ||
| 152 | - | ||
| 153 | - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
| 154 | - . | ||
| 155 | - . | ||
| 156 | - . | ||
| 157 | -+ // [REQUIRED] Register BackgroundFetch | ||
| 158 | -+ TSBackgroundFetch.sharedInstance().didFinishLaunching(); | ||
| 159 | - return self.application(application, didFinishLaunchingWithOptions: launchOptions); | ||
| 160 | - } | ||
| 161 | -} | ||
| 162 | -``` | ||
| 163 | - | ||
| 164 | -## BackgroundFetch AppDelegate extension | ||
| 165 | - | ||
| 166 | -:warning: Deprecated iOS Background Fetch API for devices running __`< iOS 13`__. | ||
| 167 | - | ||
| 168 | -BackgroundFetch implements an `AppDelegate` method `didPerformFetchWithCompletionHandler`. You must manually add this file to the same folder where your `AppDelegate.m` lives: | ||
| 169 | - | ||
| 170 | -- In the XCode's **`Project navigator`**, right click on project's name ➜ **`Add Files to <...>`**. | ||
| 171 | -- **`node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m`**. | ||
| 172 | - | ||
| 173 | - | ||
| 174 | - | ||
| 175 | -**`node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m`** | ||
| 176 | - | ||
| 177 | - | ||
| 178 | - | ||
| @@ -1,82 +0,0 @@ | |||
| 1 | -# iOS Installation with CocoaPods | ||
| 2 | - | ||
| 3 | -## With `yarn` | ||
| 4 | - | ||
| 5 | -```bash | ||
| 6 | -$ yarn add react-native-background-fetch | ||
| 7 | -``` | ||
| 8 | - | ||
| 9 | -## With `npm` | ||
| 10 | -```bash | ||
| 11 | -$ npm install --save react-native-background-fetch | ||
| 12 | -``` | ||
| 13 | - | ||
| 14 | -### `Podfile` | ||
| 15 | - | ||
| 16 | -If you **don't** already have an `ios/Podfile` initialized, run the following command: | ||
| 17 | -```shell | ||
| 18 | -$ cd ios | ||
| 19 | -$ pod init | ||
| 20 | -``` | ||
| 21 | - | ||
| 22 | -Replace the contents of `Podfile` with the following, substituting `_YOUR_PROJECT_TARGET`: | ||
| 23 | -```ruby | ||
| 24 | -# Uncomment the next line to define a global platform for your project | ||
| 25 | -# platform :ios, '9.0' | ||
| 26 | - | ||
| 27 | -target '_YOUR_PROJECT_TARGET_' do | ||
| 28 | - rn_path = '../node_modules/react-native' | ||
| 29 | - | ||
| 30 | - # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies | ||
| 31 | - pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec" | ||
| 32 | - pod 'React', path: rn_path, subspecs: [ | ||
| 33 | - 'Core', | ||
| 34 | - 'CxxBridge', | ||
| 35 | - 'DevSupport', | ||
| 36 | - 'RCTActionSheet', | ||
| 37 | - 'RCTAnimation', | ||
| 38 | - 'RCTGeolocation', | ||
| 39 | - 'RCTImage', | ||
| 40 | - 'RCTLinkingIOS', | ||
| 41 | - 'RCTNetwork', | ||
| 42 | - 'RCTSettings', | ||
| 43 | - 'RCTText', | ||
| 44 | - 'RCTVibration', | ||
| 45 | - 'RCTWebSocket', | ||
| 46 | - ] | ||
| 47 | - | ||
| 48 | - # React Native third party dependencies podspecs | ||
| 49 | - pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec" | ||
| 50 | - pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec" | ||
| 51 | - # If you are using React Native <0.54, you will get the following error: | ||
| 52 | - # "The name of the given podspec `GLog` doesn't match the expected one `glog`" | ||
| 53 | - # Use the following line instead: | ||
| 54 | - #pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec" | ||
| 55 | - pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec" | ||
| 56 | - | ||
| 57 | -end | ||
| 58 | - | ||
| 59 | -post_install do |installer| | ||
| 60 | - installer.pods_project.targets.each do |target| | ||
| 61 | - if target.name == "React" | ||
| 62 | - target.remove_from_project | ||
| 63 | - end | ||
| 64 | - end | ||
| 65 | -end | ||
| 66 | - | ||
| 67 | -``` | ||
| 68 | - | ||
| 69 | -### `react-native link` | ||
| 70 | - | ||
| 71 | -Running `react-native link` will automatically install the plugin into your `Podfile`. | ||
| 72 | - | ||
| 73 | -- Follow the [`react-native link` instructions](./INSTALL-LINK-IOS.md). | ||
| 74 | -- Install the new CocoaPods: | ||
| 75 | - | ||
| 76 | -```shell | ||
| 77 | -$ cd ios | ||
| 78 | -$ pod install | ||
| 79 | -``` | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - | ||
| @@ -1,80 +0,0 @@ | |||
| 1 | -# Expo Setup | ||
| 2 | - | ||
| 3 | -```bash | ||
| 4 | -npx expo install react-native-background-fetch | ||
| 5 | -``` | ||
| 6 | - | ||
| 7 | -### :open_file_folder: **`app.json`** | ||
| 8 | - | ||
| 9 | -- Add the following to __`plugins`__: | ||
| 10 | - | ||
| 11 | -```diff | ||
| 12 | -{ | ||
| 13 | - "expo": { | ||
| 14 | - "name": "your-app-name", | ||
| 15 | - "plugins": [ | ||
| 16 | -+ "react-native-background-fetch" | ||
| 17 | - ] | ||
| 18 | - } | ||
| 19 | -} | ||
| 20 | -``` | ||
| 21 | - | ||
| 22 | -- Add the following __`UIBackgroundModes`__ and __`BGTaskSchedulerPermittedIdentifiers`__ to the __`ios.infoPlist`__ section: | ||
| 23 | - | ||
| 24 | - | ||
| 25 | -```diff | ||
| 26 | -{ | ||
| 27 | - "expo": { | ||
| 28 | - "name": "your-app-name", | ||
| 29 | - "plugins": [ | ||
| 30 | - "react-native-background-fetch" | ||
| 31 | - ], | ||
| 32 | - "ios": { | ||
| 33 | -+ "infoPlist": { | ||
| 34 | -+ "UIBackgroundModes": [ | ||
| 35 | -+ "fetch", | ||
| 36 | -+ "processing" | ||
| 37 | -+ ], | ||
| 38 | -+ "BGTaskSchedulerPermittedIdentifiers": [ | ||
| 39 | -+ "com.transistorsoft.fetch" | ||
| 40 | -+ ] | ||
| 41 | -+ } | ||
| 42 | - } | ||
| 43 | - } | ||
| 44 | -} | ||
| 45 | -``` | ||
| 46 | - | ||
| 47 | -- If you intend to execute your own custom tasks via **`BackgroundFetch.scheduleTask`**, you must add those custom identifiers as well to the __`BGTaskSchedulerPermittedIdentifiers`__. For example, if you intend to execute a custom **`taskId: 'com.transistorsoft.customtask'`**, you must add the identifier **`com.transistorsoft.customtask`** to `BGTaskSchedulerPermittedIdentifiers`: | ||
| 48 | - | ||
| 49 | -```diff | ||
| 50 | - "BGTaskSchedulerPermittedIdentifiers": [ | ||
| 51 | - "com.transistorsoft.fetch", | ||
| 52 | -+ "com.transistorsoft.customtask" | ||
| 53 | - ] | ||
| 54 | -``` | ||
| 55 | - | ||
| 56 | -:warning: A task identifier can be any string you wish, but it's a good idea to prefix them now with `com.transistorsoft.` — In the future, the `com.transistorsoft` prefix **may become required**. | ||
| 57 | - | ||
| 58 | -```javascript | ||
| 59 | -BackgroundFetch.scheduleTask({ | ||
| 60 | - taskId: 'com.transistorsoft.customtask', | ||
| 61 | - delay: 60 * 60 * 1000 // In one hour (milliseconds) | ||
| 62 | -}); | ||
| 63 | -``` | ||
| 64 | - | ||
| 65 | -### Re-build | ||
| 66 | - | ||
| 67 | -You must rebuild your Android app for the added plugins to be evaluated. | ||
| 68 | - | ||
| 69 | -- If you're developing locally: | ||
| 70 | - | ||
| 71 | -```bash | ||
| 72 | -npx expo prebuild | ||
| 73 | -``` | ||
| 74 | - | ||
| 75 | -- If you're using *Expo EAS*: | ||
| 76 | -```bash | ||
| 77 | -eas build --profile development --platform android | ||
| 78 | -``` | ||
| 79 | - | ||
| 80 | - | ||
| @@ -1,19 +0,0 @@ | |||
| 1 | -# Android `react-native link` Installation | ||
| 2 | - | ||
| 3 | -No manual steps required. | ||
| 4 | - | ||
| 5 | -### With `yarn` | ||
| 6 | - | ||
| 7 | -```bash | ||
| 8 | -$ yarn add react-native-background-fetch | ||
| 9 | -``` | ||
| 10 | - | ||
| 11 | -### With `npm` | ||
| 12 | -```bash | ||
| 13 | -$ npm install --save react-native-background-fetch | ||
| 14 | -``` | ||
| 15 | - | ||
| 16 | -### `react-native link` | ||
| 17 | -```bash | ||
| 18 | -$ react-native link react-native-background-fetch | ||
| 19 | -``` | ||
| @@ -1,87 +0,0 @@ | |||
| 1 | -# iOS Installation with `react-native link` | ||
| 2 | - | ||
| 3 | -### With `yarn` | ||
| 4 | - | ||
| 5 | -```bash | ||
| 6 | -$ yarn add react-native-background-fetch | ||
| 7 | -``` | ||
| 8 | - | ||
| 9 | -### With `npm` | ||
| 10 | -```bash | ||
| 11 | -$ npm install --save react-native-background-fetch | ||
| 12 | -``` | ||
| 13 | - | ||
| 14 | -### `react-native link` | ||
| 15 | - | ||
| 16 | -```bash | ||
| 17 | -$ react-native link react-native-background-fetch | ||
| 18 | -``` | ||
| 19 | - | ||
| 20 | -### `pod install` | ||
| 21 | - | ||
| 22 | -```bash | ||
| 23 | -$ cd ios | ||
| 24 | -$ pod install | ||
| 25 | -``` | ||
| 26 | - | ||
| 27 | -## Configure Background Capabilities | ||
| 28 | - | ||
| 29 | -- Select the root of your project. Select **Capabilities** tab. Enable **Background Modes** and enable the following mode: | ||
| 30 | - | ||
| 31 | -- [x] Background fetch | ||
| 32 | -- [x] Background processing (:new: __iOS 13+__; Only if you intend to use `BackgroundFetch.scheduleTask`) | ||
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | -## Configure `Info.plist` (:new: __iOS 13+__) | ||
| 38 | -1. Open your `Info.plist` and the key *"Permitted background task scheduler identifiers"* | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | -2. Add the **required identifier `com.transistorsoft.fetch`**. | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | -3. If you intend to execute your own custom tasks via **`BackgroundFetch.scheduleTask`**, you must add those custom identifiers as well. For example, if you intend to execute a custom **`taskId: 'com.foo.customtask'`**, you must add the identifier **`com.foo.customtask`** to your *"Permitted background task scheduler identifiers"*, as well. | ||
| 47 | - | ||
| 48 | -```dart | ||
| 49 | -BackgroundFetch.scheduleTask({ | ||
| 50 | - taskId: 'com.foo.customtask', | ||
| 51 | - delay: 60 * 60 * 1000 // In one hour (milliseconds) | ||
| 52 | -}); | ||
| 53 | -``` | ||
| 54 | - | ||
| 55 | -## `AppDelegate.m` (:new: __iOS 13+__) | ||
| 56 | - | ||
| 57 | -The [**`BGTaskScheduler`**](https://developer.apple.com/documentation/backgroundtasks/bgtaskscheduler?language=objc) API introduced in iOS 13 requires special setup: | ||
| 58 | - | ||
| 59 | -```diff | ||
| 60 | -+#import <TSBackgroundFetch/TSBackgroundFetch.h> | ||
| 61 | - | ||
| 62 | -@implementation AppDelegate | ||
| 63 | - | ||
| 64 | -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
| 65 | - . | ||
| 66 | - . | ||
| 67 | - . | ||
| 68 | -+ // [REQUIRED] Register BackgroundFetch | ||
| 69 | -+ [[TSBackgroundFetch sharedInstance] didFinishLaunching]; | ||
| 70 | - | ||
| 71 | - return YES; | ||
| 72 | -} | ||
| 73 | -``` | ||
| 74 | - | ||
| 75 | -## BackgroundFetch AppDelegate extension | ||
| 76 | - | ||
| 77 | -:warning: Deprecated iOS Background Fetch API for devices running __`< iOS 13`__. | ||
| 78 | - | ||
| 79 | -BackgroundFetch implements an `AppDelegate` method `didPerformFetchWithCompletionHandler`. You must manually add this file to the same folder where your `AppDelegate.m` lives: | ||
| 80 | - | ||
| 81 | -- In the XCode's **`Project navigator`**, right click on project's name ➜ **`Add Files to <...>`**. | ||
| 82 | -- **`node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m`**. | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - | ||
| 86 | -**`node_modules/react-native-background-fetch/ios/RNBackgroundFetch/RNBackgroundFetch+AppDelegate.m`** | ||
| 87 | - | ||
| @@ -1,51 +0,0 @@ | |||
| 1 | -# Android Manual Installation | ||
| 2 | - | ||
| 3 | -## With `yarn` | ||
| 4 | - | ||
| 5 | -```bash | ||
| 6 | -$ yarn add react-native-background-fetch | ||
| 7 | -``` | ||
| 8 | - | ||
| 9 | -## With `npm` | ||
| 10 | - | ||
| 11 | -```bash | ||
| 12 | -$ npm install --save react-native-background-fetch | ||
| 13 | -``` | ||
| 14 | - | ||
| 15 | -## Gradle Configuration | ||
| 16 | - | ||
| 17 | -### :open_file_folder: **`android/settings.gradle`** | ||
| 18 | - | ||
| 19 | -```diff | ||
| 20 | -+include ':react-native-background-fetch' | ||
| 21 | -+project(':react-native-background-fetch').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-background-fetch/android') | ||
| 22 | -``` | ||
| 23 | - | ||
| 24 | -------------------------------------------------------------------------------- | ||
| 25 | - | ||
| 26 | - | ||
| 27 | -### :open_file_folder: **`android/app/build.gradle`** | ||
| 28 | - | ||
| 29 | -```diff | ||
| 30 | -dependencies { | ||
| 31 | -+ implementation project(':react-native-background-fetch') | ||
| 32 | -} | ||
| 33 | -``` | ||
| 34 | - | ||
| 35 | - | ||
| 36 | -## MainApplication.java | ||
| 37 | - | ||
| 38 | -### :open_file_folder: **`android/app/main/java/com/.../MainApplication.java`** | ||
| 39 | - | ||
| 40 | -```diff | ||
| 41 | -+import com.transistorsoft.rnbackgroundfetch.RNBackgroundFetchPackage; | ||
| 42 | -public class MainApplication extends ReactApplication { | ||
| 43 | - @Override | ||
| 44 | - protected List<ReactPackage> getPackages() { | ||
| 45 | - return Arrays.<ReactPackage>asList( | ||
| 46 | -+ new RNBackgroundFetchPackage(), | ||
| 47 | - new MainReactPackage() | ||
| 48 | - ); | ||
| 49 | - } | ||
| 50 | -} | ||
| 51 | -``` | ||
| @@ -1,50 +0,0 @@ | |||
| 1 | -# iOS Manual Installation | ||
| 2 | - | ||
| 3 | -- `npm install react-native-background-fetch --save` | ||
| 4 | - | ||
| 5 | -- In the XCode's **`Project navigator`**, right click on project's name ➜ **`Add Files to <...>`** | ||
| 6 | - | ||
| 7 | - | ||
| 8 | -- Add **`node_modules/react-native-background-fetch/ios/RNBackgroundFetch.xcodeproj`** | ||
| 9 | - | ||
| 10 | - | ||
| 11 | -## Build Phases ➜ Link Binary With Libraries | ||
| 12 | - | ||
| 13 | -- Select your project in the **`Project navigator`**. Click **`Build Phases`** then **`Link Binary With Libraries`**. Add the following static library: | ||
| 14 | -- **`libRNBackgroundFetch.a`**. | ||
| 15 | - | ||
| 16 | - | ||
| 17 | -- BackgroundGeolocation includes custom iOS framework. This needs to be added manually, unfortunately. | ||
| 18 | - - Click **`[Add Other...]`**. | ||
| 19 | - - Navigate: **`node_modules/react-native-background-fetch/ios/RNBackgroundFetch`**. | ||
| 20 | - - Add **`TSBackgroundFetch.framework`**. | ||
| 21 | - | ||
| 22 | - | ||
| 23 | -## Build Settings ➜ Framework Search Paths | ||
| 24 | - | ||
| 25 | -- In order to the find the **`TSBackgroundFetch.framework`** you just added, you have to tell Xcode where it can find it: | ||
| 26 | - - Go to **Build Settings** and search for **"framework search path"**. | ||
| 27 | - - Add the following paths (select **recursive [v]**): | ||
| 28 | - | ||
| 29 | -``` | ||
| 30 | -$(PROJECT_DIR)/../node_modules/react-native-background-fetch/ios | ||
| 31 | -``` | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 35 | -## Configure Background Capabilities | ||
| 36 | - | ||
| 37 | -- Select the root of your project. Select **Capabilities** tab. Enable **Background Modes** and enable the following mode: | ||
| 38 | - | ||
| 39 | -- [x] Background fetch | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | -## BackgroundFetch AppDelegate extension | ||
| 44 | - | ||
| 45 | -BackgroundFetch implements an `AppDelegate` method `didPerformFetchWithCompletionHandler`. You must manually add this file to the same folder where your `AppDelegate.m` lives: | ||
| 46 | - | ||
| 47 | -- Expand the **`RNBackgroundFetch`** project and drag/drop the file **`RNBackgroundFetch+AppDelegate.m`** and place the file to exist **in the same folder** as your app's **`AppDelegate.m`**. | ||
| 48 | - | ||
| 49 | - | ||
| 50 | -You can now [import and build](../README.md#example) | ||
| @@ -1,6 +0,0 @@ | |||
| 1 | - | ||
| 2 | -[android] | ||
| 3 | - target = Google Inc.:Google APIs:23 | ||
| 4 | - | ||
| 5 | -[maven_repositories] | ||
| 6 | - central = https://repo1.maven.org/maven2 | ||
| @@ -1,3 +0,0 @@ | |||
| 1 | -# Windows files | ||
| 2 | -[*.bat] | ||
| 3 | -end_of_line = crlf | ||
| @@ -1,4 +0,0 @@ | |||
| 1 | -module.exports = { | ||
| 2 | - root: true, | ||
| 3 | - extends: '@react-native-community', | ||
| 4 | -}; | ||
| @@ -1,3 +0,0 @@ | |||
| 1 | -# Windows files should use crlf line endings | ||
| 2 | -# https://help.github.com/articles/dealing-with-line-endings/ | ||
| 3 | -*.bat text eol=crlf | ||
| @@ -1,64 +0,0 @@ | |||
| 1 | -# OSX | ||
| 2 | -# | ||
| 3 | -.DS_Store | ||
| 4 | - | ||
| 5 | -# Xcode | ||
| 6 | -# | ||
| 7 | -build/ | ||
| 8 | -*.pbxuser | ||
| 9 | -!default.pbxuser | ||
| 10 | -*.mode1v3 | ||
| 11 | -!default.mode1v3 | ||
| 12 | -*.mode2v3 | ||
| 13 | -!default.mode2v3 | ||
| 14 | -*.perspectivev3 | ||
| 15 | -!default.perspectivev3 | ||
| 16 | -xcuserdata | ||
| 17 | -*.xccheckout | ||
| 18 | -*.moved-aside | ||
| 19 | -DerivedData | ||
| 20 | -*.hmap | ||
| 21 | -*.ipa | ||
| 22 | -*.xcuserstate | ||
| 23 | -ios/.xcode.env.local | ||
| 24 | - | ||
| 25 | -# Android/IntelliJ | ||
| 26 | -# | ||
| 27 | -build/ | ||
| 28 | -.idea | ||
| 29 | -.gradle | ||
| 30 | -local.properties | ||
| 31 | -*.iml | ||
| 32 | -*.hprof | ||
| 33 | -.cxx/ | ||
| 34 | - | ||
| 35 | -# node.js | ||
| 36 | -# | ||
| 37 | -node_modules/ | ||
| 38 | -npm-debug.log | ||
| 39 | -yarn-error.log | ||
| 40 | - | ||
| 41 | -# BUCK | ||
| 42 | -buck-out/ | ||
| 43 | -\.buckd/ | ||
| 44 | -*.keystore | ||
| 45 | -!debug.keystore | ||
| 46 | - | ||
| 47 | -# fastlane | ||
| 48 | -# | ||
| 49 | -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the | ||
| 50 | -# screenshots whenever they are needed. | ||
| 51 | -# For more information about the recommended setup visit: | ||
| 52 | -# https://docs.fastlane.tools/best-practices/source-control/ | ||
| 53 | - | ||
| 54 | -*/fastlane/report.xml | ||
| 55 | -*/fastlane/Preview.html | ||
| 56 | -*/fastlane/screenshots | ||
| 57 | -**/fastlane/test_output | ||
| 58 | - | ||
| 59 | -# Bundle artifact | ||
| 60 | -*.jsbundle | ||
| 61 | - | ||
| 62 | -# Ruby / CocoaPods | ||
| 63 | -/ios/Pods/ | ||
| 64 | -/vendor/bundle/ | ||
| @@ -1,10 +0,0 @@ | |||
| 1 | -module.exports = { | ||
| 2 | - bracketSpacing: false, | ||
| 3 | - jsxBracketSameLine: true, | ||
| 4 | - arrowParens: 'avoid', | ||
| 5 | - bracketSameLine: true, | ||
| 6 | - bracketSpacing: false, | ||
| 7 | - singleQuote: true, | ||
| 8 | - trailingComma: 'all', | ||
| 9 | - arrowParens: 'avoid', | ||
| 10 | -}; | ||
| @@ -1 +0,0 @@ | |||
| 1 | -2.7.5 | ||
| @@ -1 +0,0 @@ | |||
| 1 | -{} | ||
| @@ -1,231 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | - * Sample React Native App | ||
| 3 | - * https://github.com/facebook/react-native | ||
| 4 | - * | ||
| 5 | - * Generated with the TypeScript template | ||
| 6 | - * https://github.com/react-native-community/react-native-template-typescript | ||
| 7 | - * | ||
| 8 | - * @format | ||
| 9 | - */ | ||
| 10 | - | ||
| 11 | -import React from 'react'; | ||
| 12 | -import { | ||
| 13 | - SafeAreaView, | ||
| 14 | - ScrollView, | ||
| 15 | - StatusBar, | ||
| 16 | - StyleSheet, | ||
| 17 | - Text, | ||
| 18 | - View, | ||
| 19 | - Switch, | ||
| 20 | - Button, | ||
| 21 | - Alert | ||
| 22 | -} from 'react-native'; | ||
| 23 | - | ||
| 24 | -import BackgroundFetch from "react-native-background-fetch"; | ||
| 25 | - | ||
| 26 | -const Colors = { | ||
| 27 | - gold: '#fedd1e', | ||
| 28 | - black: '#000', | ||
| 29 | - white: '#fff', | ||
| 30 | - lightGrey: '#ccc', | ||
| 31 | - blue: '#337AB7', | ||
| 32 | -} | ||
| 33 | - | ||
| 34 | -/// Util class for handling fetch-event peristence in AsyncStorage. | ||
| 35 | -import Event from "./src/Event"; | ||
| 36 | - | ||
| 37 | -const App = () => { | ||
| 38 | - | ||
| 39 | - const [enabled, setEnabled] = React.useState(false); | ||
| 40 | - const [status, setStatus] = React.useState(-1); | ||
| 41 | - const [events, setEvents] = React.useState<Event[]>([]); | ||
| 42 | - | ||
| 43 | - React.useEffect(() => { | ||
| 44 | - initBackgroundFetch() | ||
| 45 | - loadEvents(); | ||
| 46 | - }, []); | ||
| 47 | - | ||
| 48 | - /// Configure BackgroundFetch. | ||
| 49 | - /// | ||
| 50 | - const initBackgroundFetch = async () => { | ||
| 51 | - const status:number = await BackgroundFetch.configure({ | ||
| 52 | - minimumFetchInterval: 15, // <-- minutes (15 is minimum allowed) | ||
| 53 | - stopOnTerminate: false, | ||
| 54 | - enableHeadless: true, | ||
| 55 | - startOnBoot: true, | ||
| 56 | - // Android options | ||
| 57 | - forceAlarmManager: false, // <-- Set true to bypass JobScheduler. | ||
| 58 | - requiredNetworkType: BackgroundFetch.NETWORK_TYPE_NONE, // Default | ||
| 59 | - requiresCharging: false, // Default | ||
| 60 | - requiresDeviceIdle: false, // Default | ||
| 61 | - requiresBatteryNotLow: false, // Default | ||
| 62 | - requiresStorageNotLow: false, // Default | ||
| 63 | - }, async (taskId:string) => { | ||
| 64 | - console.log('[BackgroundFetch] taskId', taskId); | ||
| 65 | - // Create an Event record. | ||
| 66 | - const event = await Event.create(taskId, false); | ||
| 67 | - // Update state. | ||
| 68 | - setEvents((prev) => [...prev, event]); | ||
| 69 | - // Finish. | ||
| 70 | - BackgroundFetch.finish(taskId); | ||
| 71 | - }, (taskId:string) => { | ||
| 72 | - // Oh No! Our task took too long to complete and the OS has signalled | ||
| 73 | - // that this task must be finished immediately. | ||
| 74 | - console.log('[Fetch] TIMEOUT taskId:', taskId); | ||
| 75 | - BackgroundFetch.finish(taskId); | ||
| 76 | - }); | ||
| 77 | - setStatus(status); | ||
| 78 | - setEnabled(true); | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - /// Load persisted events from AsyncStorage. | ||
| 82 | - /// | ||
| 83 | - const loadEvents = () => { | ||
| 84 | - Event.all().then((data) => { | ||
| 85 | - setEvents(data); | ||
| 86 | - }).catch((error) => { | ||
| 87 | - Alert.alert('Error', 'Failed to load data from AsyncStorage: ' + error); | ||
| 88 | - }); | ||
| 89 | - } | ||
| 90 | - | ||
| 91 | - /// Toggle BackgroundFetch ON/OFF | ||
| 92 | - /// | ||
| 93 | - const onClickToggleEnabled = (value:boolean) => { | ||
| 94 | - setEnabled(value); | ||
| 95 | - | ||
| 96 | - if (value) { | ||
| 97 | - BackgroundFetch.start(); | ||
| 98 | - } else { | ||
| 99 | - BackgroundFetch.stop(); | ||
| 100 | - } | ||
| 101 | - } | ||
| 102 | - | ||
| 103 | - /// [Status] button handler. | ||
| 104 | - /// | ||
| 105 | - const onClickStatus = () => { | ||
| 106 | - BackgroundFetch.status().then((status:number) => { | ||
| 107 | - let statusConst = ''; | ||
| 108 | - switch (status) { | ||
| 109 | - case BackgroundFetch.STATUS_AVAILABLE: | ||
| 110 | - statusConst = 'STATUS_AVAILABLE'; | ||
| 111 | - break; | ||
| 112 | - case BackgroundFetch.STATUS_DENIED: | ||
| 113 | - statusConst = 'STATUS_DENIED'; | ||
| 114 | - break; | ||
| 115 | - case BackgroundFetch.STATUS_RESTRICTED: | ||
| 116 | - statusConst = 'STATUS_RESTRICTED'; | ||
| 117 | - break; | ||
| 118 | - } | ||
| 119 | - Alert.alert('BackgroundFetch.status()', `${statusConst} (${status})`); | ||
| 120 | - }); | ||
| 121 | - } | ||
| 122 | - | ||
| 123 | - /// [scheduleTask] button handler. | ||
| 124 | - /// Schedules a custom-task to fire in 5000ms | ||
| 125 | - /// | ||
| 126 | - const onClickScheduleTask = () => { | ||
| 127 | - BackgroundFetch.scheduleTask({ | ||
| 128 | - taskId: 'com.transistorsoft.customtask', | ||
| 129 | - delay: 5000, | ||
| 130 | - forceAlarmManager: true | ||
| 131 | - }).then(() => { | ||
| 132 | - Alert.alert('scheduleTask', 'Scheduled task with delay: 5000ms'); | ||
| 133 | - }).catch((error) => { | ||
| 134 | - Alert.alert('scheduleTask ERROR', error); | ||
| 135 | - }); | ||
| 136 | - } | ||
| 137 | - | ||
| 138 | - /// Clear the Events list. | ||
| 139 | - /// | ||
| 140 | - const onClickClear = () => { | ||
| 141 | - Event.destroyAll(); | ||
| 142 | - setEvents([]); | ||
| 143 | - } | ||
| 144 | - | ||
| 145 | - /// Fetch events renderer. | ||
| 146 | - /// | ||
| 147 | - const renderEvents = () => { | ||
| 148 | - if (!events.length) { | ||
| 149 | - return ( | ||
| 150 | - <Text style={{padding: 10, fontSize: 16}}>Waiting for BackgroundFetch events...</Text> | ||
| 151 | - ); | ||
| 152 | - } | ||
| 153 | - return events.slice().reverse().map(event => ( | ||
| 154 | - <View key={event.key} style={styles.event}> | ||
| 155 | - <View style={{flexDirection: 'row'}}> | ||
| 156 | - <Text style={styles.taskId}>{event.taskId} {event.isHeadless ? '[Headless]' : ''}</Text> | ||
| 157 | - </View> | ||
| 158 | - <Text style={styles.timestamp}>{event.timestamp}</Text> | ||
| 159 | - </View> | ||
| 160 | - )) | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - return ( | ||
| 164 | - <SafeAreaView style={{flex:1, backgroundColor:Colors.gold}}> | ||
| 165 | - <StatusBar barStyle={'light-content'}> | ||
| 166 | - </StatusBar> | ||
| 167 | - <View style={styles.container}> | ||
| 168 | - <View style={styles.toolbar}> | ||
| 169 | - <Text style={styles.title}>BGFetch Demo</Text> | ||
| 170 | - <Switch value={enabled} onValueChange={onClickToggleEnabled} /> | ||
| 171 | - </View> | ||
| 172 | - <ScrollView | ||
| 173 | - contentInsetAdjustmentBehavior="automatic" | ||
| 174 | - style={styles.eventList}> | ||
| 175 | - {renderEvents()} | ||
| 176 | - </ScrollView> | ||
| 177 | - <View style={styles.toolbar}> | ||
| 178 | - <Button title={"status: " + status} onPress={onClickStatus} /> | ||
| 179 | - <Text> </Text> | ||
| 180 | - <Button title="scheduleTask" onPress={onClickScheduleTask} /> | ||
| 181 | - <View style={{flex:1}} /> | ||
| 182 | - <Button title="clear" onPress={onClickClear} /> | ||
| 183 | - </View> | ||
| 184 | - </View> | ||
| 185 | - </SafeAreaView> | ||
| 186 | - ); | ||
| 187 | -}; | ||
| 188 | - | ||
| 189 | -const styles = StyleSheet.create({ | ||
| 190 | - container: { | ||
| 191 | - flexDirection: 'column', | ||
| 192 | - flex: 1 | ||
| 193 | - }, | ||
| 194 | - title: { | ||
| 195 | - fontSize: 24, | ||
| 196 | - flex: 1, | ||
| 197 | - fontWeight: 'bold', | ||
| 198 | - color: Colors.black | ||
| 199 | - }, | ||
| 200 | - eventList: { | ||
| 201 | - flex: 1, | ||
| 202 | - backgroundColor: Colors.white | ||
| 203 | - }, | ||
| 204 | - event: { | ||
| 205 | - padding: 10, | ||
| 206 | - borderBottomWidth: 1, | ||
| 207 | - borderColor: Colors.lightGrey | ||
| 208 | - }, | ||
| 209 | - taskId: { | ||
| 210 | - color: Colors.blue, | ||
| 211 | - fontSize: 16, | ||
| 212 | - fontWeight: 'bold' | ||
| 213 | - }, | ||
| 214 | - headless: { | ||
| 215 | - fontWeight: 'bold' | ||
| 216 | - }, | ||
| 217 | - timestamp: { | ||
| 218 | - color: Colors.black | ||
| 219 | - }, | ||
| 220 | - toolbar: { | ||
| 221 | - height: 57, | ||
| 222 | - flexDirection: 'row', | ||
| 223 | - paddingLeft: 10, | ||
| 224 | - paddingRight: 10, | ||
| 225 | - alignItems: 'center', | ||
| 226 | - backgroundColor: Colors.gold | ||
| 227 | - }, | ||
| 228 | - | ||
| 229 | -}); | ||
| 230 | - | ||
| 231 | -export default App; | ||
| @@ -1,5 +0,0 @@ | |||
| 1 | -source 'https://rubygems.org' | ||
| 2 | -# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version | ||
| 3 | -ruby '2.7.5' | ||
| 4 | -gem 'cocoapods', '~> 1.11', '>= 1.11.2' | ||
| 5 | - | ||
| @@ -1,61 +0,0 @@ | |||
| 1 | -react-native-background-fetch Example App | ||
| 2 | -============================================================ | ||
| 3 | - | ||
| 4 | -# Installation | ||
| 5 | - | ||
| 6 | -1. Clone this repo | ||
| 7 | - | ||
| 8 | -``` | ||
| 9 | -$ git clone <url> | ||
| 10 | -$ cd example | ||
| 11 | -$ yarn install | ||
| 12 | - | ||
| 13 | -$ cd ios | ||
| 14 | -$ pod install | ||
| 15 | - | ||
| 16 | -# Edit the ios/FetchDemo.xcodeproj/project.pbxproj file and set both lines with DEVELOPMENT_TEAM to your own Team ID. This can be found at https://developer.apple.com/account under Membership. | ||
| 17 | - | ||
| 18 | -$ npx react-native run-android | ||
| 19 | -$ npx react-native run-ios | ||
| 20 | -``` | ||
| 21 | - | ||
| 22 | -:warning: __iOS__: Test on a real device. The new iOS 13 `BGTaskScheduler` API does not work on Simulators. | ||
| 23 | - | ||
| 24 | -# Simulating Events | ||
| 25 | - | ||
| 26 | -## iOS | ||
| 27 | - | ||
| 28 | -#### :new: `BGTaskScheduler` API for iOS 13+ | ||
| 29 | - | ||
| 30 | -- :warning: At the time of writing, the new task simulator does not yet work in Simulator; Only real devices. | ||
| 31 | -- See Apple docs [Starting and Terminating Tasks During Development](https://developer.apple.com/documentation/backgroundtasks/starting_and_terminating_tasks_during_development?language=objc) | ||
| 32 | -- After running your app in XCode, Click the `[||]` button to initiate a *Breakpoint*. | ||
| 33 | -- In the console `(lldb)`, paste the following command (**Note:** use cursor up/down keys to cycle through previously run commands): | ||
| 34 | -```obj-c | ||
| 35 | -e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.transistorsoft.fetch"] | ||
| 36 | -``` | ||
| 37 | -- Click the `[ > ]` button to continue. The task will execute and the Callback function provided to **`BackgroundFetch.configure`** will receive the event. | ||
| 38 | - | ||
| 39 | - | ||
| 40 | - | ||
| 41 | - | ||
| 42 | - | ||
| 43 | - | ||
| 44 | - | ||
| 45 | - | ||
| 46 | -#### Old `BackgroundFetch` API | ||
| 47 | -- Simulate background fetch events in XCode using **`Debug->Simulate Background Fetch`** | ||
| 48 | -- iOS can take some hours or even days to start a consistently scheduling background-fetch events since iOS schedules fetch events based upon the user's patterns of activity. If *Simulate Background Fetch* works, your can be **sure** that everything is working fine. You just need to wait. | ||
| 49 | - | ||
| 50 | -## Android | ||
| 51 | - | ||
| 52 | -- Observe plugin logs in `$ adb logcat`: | ||
| 53 | -```bash | ||
| 54 | -$ adb logcat *:S ReactNative:V ReactNativeJS:V TSBackgroundFetch:V | ||
| 55 | -``` | ||
| 56 | - | ||
| 57 | -- Simulate a background-fetch event on a device (insert *<your.application.id>*) (only works for sdk `21+`: | ||
| 58 | -```bash | ||
| 59 | -$ ./scripts/simulate-fetch | ||
| 60 | -``` | ||
| 61 | - | ||
| @@ -1,14 +0,0 @@ | |||
| 1 | -/** | ||
| 2 | - * @format | ||
| 3 | - */ | ||
| 4 | - | ||
| 5 | -import 'react-native'; | ||
| 6 | -import React from 'react'; | ||
| 7 | -import App from '../App'; | ||
| 8 | - | ||
| 9 | -// Note: test renderer must be required after react-native. | ||
| 10 | -import renderer from 'react-test-renderer'; | ||
| 11 | - | ||
| 12 | -it('renders correctly', () => { | ||
| 13 | - renderer.create(<App />); | ||
| 14 | -}); | ||
| @@ -1,55 +0,0 @@ | |||
| 1 | -# To learn about Buck see [Docs](https://buckbuild.com/). | ||
| 2 | -# To run your application with Buck: | ||
| 3 | -# - install Buck | ||
| 4 | -# - `npm start` - to start the packager | ||
| 5 | -# - `cd android` | ||
| 6 | -# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` | ||
| 7 | -# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck | ||
| 8 | -# - `buck install -r android/app` - compile, install and run application | ||
| 9 | -# | ||
| 10 | - | ||
| 11 | -load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") | ||
| 12 | - | ||
| 13 | -lib_deps = [] | ||
| 14 | - | ||
| 15 | -create_aar_targets(glob(["libs/*.aar"])) | ||
| 16 | - | ||
| 17 | -create_jar_targets(glob(["libs/*.jar"])) | ||
| 18 | - | ||
| 19 | -android_library( | ||
| 20 | - name = "all-libs", | ||
| 21 | - exported_deps = lib_deps, | ||
| 22 | -) | ||
| 23 | - | ||
| 24 | -android_library( | ||
| 25 | - name = "app-code", | ||
| 26 | - srcs = glob([ | ||
| 27 | - "src/main/java/**/*.java", | ||
| 28 | - ]), | ||
| 29 | - deps = [ | ||
| 30 | - ":all-libs", | ||
| 31 | - ":build_config", | ||
| 32 | - ":res", | ||
| 33 | - ], | ||
| 34 | -) | ||
| 35 | - | ||
| 36 | -android_build_config( | ||
| 37 | - name = "build_config", | ||
| 38 | - package = "com.fetchdemo", | ||
| 39 | -) | ||
| 40 | - | ||
| 41 | -android_resource( | ||
| 42 | - name = "res", | ||
| 43 | - package = "com.fetchdemo", | ||
| 44 | - res = "src/main/res", | ||
| 45 | -) | ||
| 46 | - | ||
| 47 | -android_binary( | ||
| 48 | - name = "app", | ||
| 49 | - keystore = "//android/keystores:debug", | ||
| 50 | - manifest = "src/main/AndroidManifest.xml", | ||
| 51 | - package_type = "debug", | ||
| 52 | - deps = [ | ||
| 53 | - ":app-code", | ||
| 54 | - ], | ||
| 55 | -) | ||
| @@ -1,310 +0,0 @@ | |||
| 1 | -apply plugin: "com.android.application" | ||
| 2 | - | ||
| 3 | -import com.android.build.OutputFile | ||
| 4 | -import org.apache.tools.ant.taskdefs.condition.Os | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets | ||
| 8 | - * and bundleReleaseJsAndAssets). | ||
| 9 | - * These basically call `react-native bundle` with the correct arguments during the Android build | ||
| 10 | - * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the | ||
| 11 | - * bundle directly from the development server. Below you can see all the possible configurations | ||
| 12 | - * and their defaults. If you decide to add a configuration block, make sure to add it before the | ||
| 13 | - * `apply from: "../../node_modules/react-native/react.gradle"` line. | ||
| 14 | - * | ||
| 15 | - * project.ext.react = [ | ||
| 16 | - * // the name of the generated asset file containing your JS bundle | ||
| 17 | - * bundleAssetName: "index.android.bundle", | ||
| 18 | - * | ||
| 19 | - * // the entry file for bundle generation. If none specified and | ||
| 20 | - * // "index.android.js" exists, it will be used. Otherwise "index.js" is | ||
| 21 | - * // default. Can be overridden with ENTRY_FILE environment variable. | ||
| 22 | - * entryFile: "index.android.js", | ||
| 23 | - * | ||
| 24 | - * // https://reactnative.dev/docs/performance#enable-the-ram-format | ||
| 25 | - * bundleCommand: "ram-bundle", | ||
| 26 | - * | ||
| 27 | - * // whether to bundle JS and assets in debug mode | ||
| 28 | - * bundleInDebug: false, | ||
| 29 | - * | ||
| 30 | - * // whether to bundle JS and assets in release mode | ||
| 31 | - * bundleInRelease: true, | ||
| 32 | - * | ||
| 33 | - * // whether to bundle JS and assets in another build variant (if configured). | ||
| 34 | - * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants | ||
| 35 | - * // The configuration property can be in the following formats | ||
| 36 | - * // 'bundleIn${productFlavor}${buildType}' | ||
| 37 | - * // 'bundleIn${buildType}' | ||
| 38 | - * // bundleInFreeDebug: true, | ||
| 39 | - * // bundleInPaidRelease: true, | ||
| 40 | - * // bundleInBeta: true, | ||
| 41 | - * | ||
| 42 | - * // whether to disable dev mode in custom build variants (by default only disabled in release) | ||
| 43 | - * // for example: to disable dev mode in the staging build type (if configured) | ||
| 44 | - * devDisabledInStaging: true, | ||
| 45 | - * // The configuration property can be in the following formats | ||
| 46 | - * // 'devDisabledIn${productFlavor}${buildType}' | ||
| 47 | - * // 'devDisabledIn${buildType}' | ||
| 48 | - * | ||
| 49 | - * // the root of your project, i.e. where "package.json" lives | ||
| 50 | - * root: "../../", | ||
| 51 | - * | ||
| 52 | - * // where to put the JS bundle asset in debug mode | ||
| 53 | - * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", | ||
| 54 | - * | ||
| 55 | - * // where to put the JS bundle asset in release mode | ||
| 56 | - * jsBundleDirRelease: "$buildDir/intermediates/assets/release", | ||
| 57 | - * | ||
| 58 | - * // where to put drawable resources / React Native assets, e.g. the ones you use via | ||
| 59 | - * // require('./image.png')), in debug mode | ||
| 60 | - * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", | ||
| 61 | - * | ||
| 62 | - * // where to put drawable resources / React Native assets, e.g. the ones you use via | ||
| 63 | - * // require('./image.png')), in release mode | ||
| 64 | - * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", | ||
| 65 | - * | ||
| 66 | - * // by default the gradle tasks are skipped if none of the JS files or assets change; this means | ||
| 67 | - * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to | ||
| 68 | - * // date; if you have any other folders that you want to ignore for performance reasons (gradle | ||
| 69 | - * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ | ||
| 70 | - * // for example, you might want to remove it from here. | ||
| 71 | - * inputExcludes: ["android/**", "ios/**"], | ||
| 72 | - * | ||
| 73 | - * // override which node gets called and with what additional arguments | ||
| 74 | - * nodeExecutableAndArgs: ["node"], | ||
| 75 | - * | ||
| 76 | - * // supply additional arguments to the packager | ||
| 77 | - * extraPackagerArgs: [] | ||
| 78 | - * ] | ||
| 79 | - */ | ||
| 80 | - | ||
| 81 | -project.ext.react = [ | ||
| 82 | - enableHermes: true, // clean and rebuild if changing | ||
| 83 | -] | ||
| 84 | - | ||
| 85 | -apply from: "../../node_modules/react-native/react.gradle" | ||
| 86 | - | ||
| 87 | -/** | ||
| 88 | - * Set this to true to create two separate APKs instead of one: | ||
| 89 | - * - An APK that only works on ARM devices | ||
| 90 | - * - An APK that only works on x86 devices | ||
| 91 | - * The advantage is the size of the APK is reduced by about 4MB. | ||
| 92 | - * Upload all the APKs to the Play Store and people will download | ||
| 93 | - * the correct one based on the CPU architecture of their device. | ||
| 94 | - */ | ||
| 95 | -def enableSeparateBuildPerCPUArchitecture = false | ||
| 96 | - | ||
| 97 | -/** | ||
| 98 | - * Run Proguard to shrink the Java bytecode in release builds. | ||
| 99 | - */ | ||
| 100 | -def enableProguardInReleaseBuilds = false | ||
| 101 | - | ||
| 102 | -/** | ||
| 103 | - * The preferred build flavor of JavaScriptCore. | ||
| 104 | - * | ||
| 105 | - * For example, to use the international variant, you can use: | ||
| 106 | - * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` | ||
| 107 | - * | ||
| 108 | - * The international variant includes ICU i18n library and necessary data | ||
| 109 | - * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that | ||
| 110 | - * give correct results when using with locales other than en-US. Note that | ||
| 111 | - * this variant is about 6MiB larger per architecture than default. | ||
| 112 | - */ | ||
| 113 | -def jscFlavor = 'org.webkit:android-jsc:+' | ||
| 114 | - | ||
| 115 | -/** | ||
| 116 | - * Whether to enable the Hermes VM. | ||
| 117 | - * | ||
| 118 | - * This should be set on project.ext.react and that value will be read here. If it is not set | ||
| 119 | - * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode | ||
| 120 | - * and the benefits of using Hermes will therefore be sharply reduced. | ||
| 121 | - */ | ||
| 122 | -def enableHermes = project.ext.react.get("enableHermes", false); | ||
| 123 | - | ||
| 124 | -/** | ||
| 125 | - * Architectures to build native code for. | ||
| 126 | - */ | ||
| 127 | -def reactNativeArchitectures() { | ||
| 128 | - def value = project.getProperties().get("reactNativeArchitectures") | ||
| 129 | - return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] | ||
| 130 | -} | ||
| 131 | - | ||
| 132 | -android { | ||
| 133 | - ndkVersion rootProject.ext.ndkVersion | ||
| 134 | - | ||
| 135 | - compileSdkVersion rootProject.ext.compileSdkVersion | ||
| 136 | - | ||
| 137 | - defaultConfig { | ||
| 138 | - applicationId "com.fetchdemo" | ||
| 139 | - minSdkVersion rootProject.ext.minSdkVersion | ||
| 140 | - targetSdkVersion rootProject.ext.targetSdkVersion | ||
| 141 | - versionCode 1 | ||
| 142 | - versionName "1.0" | ||
| 143 | - buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() | ||
| 144 | - if (isNewArchitectureEnabled()) { | ||
| 145 | - // We configure the CMake build only if you decide to opt-in for the New Architecture. | ||
| 146 | - externalNativeBuild { | ||
| 147 | - cmake { | ||
| 148 | - arguments "-DPROJECT_BUILD_DIR=$buildDir", | ||
| 149 | - "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", | ||
| 150 | - "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build", | ||
| 151 | - "-DNODE_MODULES_DIR=$rootDir/../node_modules", | ||
| 152 | - "-DANDROID_STL=c++_shared" | ||
| 153 | - } | ||
| 154 | - } | ||
| 155 | - if (!enableSeparateBuildPerCPUArchitecture) { | ||
| 156 | - ndk { | ||
| 157 | - abiFilters (*reactNativeArchitectures()) | ||
| 158 | - } | ||
| 159 | - } | ||
| 160 | - } | ||
| 161 | - } | ||
| 162 | - | ||
| 163 | - if (isNewArchitectureEnabled()) { | ||
| 164 | - // We configure the NDK build only if you decide to opt-in for the New Architecture. | ||
| 165 | - externalNativeBuild { | ||
| 166 | - cmake { | ||
| 167 | - path "$projectDir/src/main/jni/CMakeLists.txt" | ||
| 168 | - } | ||
| 169 | - } | ||
| 170 | - def reactAndroidProjectDir = project(':ReactAndroid').projectDir | ||
| 171 | - def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { | ||
| 172 | - dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") | ||
| 173 | - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") | ||
| 174 | - into("$buildDir/react-ndk/exported") | ||
| 175 | - } | ||
| 176 | - def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { | ||
| 177 | - dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") | ||
| 178 | - from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") | ||
| 179 | - into("$buildDir/react-ndk/exported") | ||
| 180 | - } | ||
| 181 | - afterEvaluate { | ||
| 182 | - // If you wish to add a custom TurboModule or component locally, | ||
| 183 | - // you should uncomment this line. | ||
| 184 | - // preBuild.dependsOn("generateCodegenArtifactsFromSchema") | ||
| 185 | - preDebugBuild.dependsOn(packageReactNdkDebugLibs) | ||
| 186 | - preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) | ||
| 187 | - // Due to a bug inside AGP, we have to explicitly set a dependency | ||
| 188 | - // between configureCMakeDebug* tasks and the preBuild tasks. | ||
| 189 | - // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 | ||
| 190 | - configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild) | ||
| 191 | - configureCMakeDebug.dependsOn(preDebugBuild) | ||
| 192 | - reactNativeArchitectures().each { architecture -> | ||
| 193 | - tasks.findByName("configureCMakeDebug[${architecture}]")?.configure { | ||
| 194 | - dependsOn("preDebugBuild") | ||
| 195 | - } | ||
| 196 | - tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure { | ||
| 197 | - dependsOn("preReleaseBuild") | ||
| 198 | - } | ||
| 199 | - } | ||
| 200 | - } | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - splits { | ||
| 204 | - abi { | ||
| 205 | - reset() | ||
| 206 | - enable enableSeparateBuildPerCPUArchitecture | ||
| 207 | - universalApk false // If true, also generate a universal APK | ||
| 208 | - include (*reactNativeArchitectures()) | ||
| 209 | - } | ||
| 210 | - } | ||
| 211 | - signingConfigs { | ||
| 212 | - debug { | ||
| 213 | - storeFile file('debug.keystore') | ||
| 214 | - storePassword 'android' | ||
| 215 | - keyAlias 'androiddebugkey' | ||
| 216 | - keyPassword 'android' | ||
| 217 | - } | ||
| 218 | - } | ||
| 219 | - buildTypes { | ||
| 220 | - debug { | ||
| 221 | - signingConfig signingConfigs.debug | ||
| 222 | - } | ||
| 223 | - release { | ||
| 224 | - // Caution! In production, you need to generate your own keystore file. | ||
| 225 | - // see https://reactnative.dev/docs/signed-apk-android. | ||
| 226 | - signingConfig signingConfigs.debug | ||
| 227 | - minifyEnabled enableProguardInReleaseBuilds | ||
| 228 | - proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | ||
| 229 | - } | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - // applicationVariants are e.g. debug, release | ||
| 233 | - applicationVariants.all { variant -> | ||
| 234 | - variant.outputs.each { output -> | ||
| 235 | - // For each separate APK per architecture, set a unique version code as described here: | ||
| 236 | - // https://developer.android.com/studio/build/configure-apk-splits.html | ||
| 237 | - // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. | ||
| 238 | - def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] | ||
| 239 | - def abi = output.getFilter(OutputFile.ABI) | ||
| 240 | - if (abi != null) { // null for the universal-debug, universal-release variants | ||
| 241 | - output.versionCodeOverride = | ||
| 242 | - defaultConfig.versionCode * 1000 + versionCodes.get(abi) | ||
| 243 | - } | ||
| 244 | - | ||
| 245 | - } | ||
| 246 | - } | ||
| 247 | -} | ||
| 248 | - | ||
| 249 | -dependencies { | ||
| 250 | - implementation fileTree(dir: "libs", include: ["*.jar"]) | ||
| 251 | - //noinspection GradleDynamicVersion | ||
| 252 | - implementation "com.facebook.react:react-native:+" // From node_modules | ||
| 253 | - | ||
| 254 | - implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" | ||
| 255 | - | ||
| 256 | - debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { | ||
| 257 | - exclude group:'com.facebook.fbjni' | ||
| 258 | - } | ||
| 259 | - | ||
| 260 | - debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { | ||
| 261 | - exclude group:'com.facebook.flipper' | ||
| 262 | - exclude group:'com.squareup.okhttp3', module:'okhttp' | ||
| 263 | - } | ||
| 264 | - | ||
| 265 | - debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { | ||
| 266 | - exclude group:'com.facebook.flipper' | ||
| 267 | - } | ||
| 268 | - | ||
| 269 | - if (enableHermes) { | ||
| 270 | - //noinspection GradleDynamicVersion | ||
| 271 | - implementation("com.facebook.react:hermes-engine:+") { // From node_modules | ||
| 272 | - exclude group:'com.facebook.fbjni' | ||
| 273 | - } | ||
| 274 | - } else { | ||
| 275 | - implementation jscFlavor | ||
| 276 | - } | ||
| 277 | -} | ||
| 278 | - | ||
| 279 | -if (isNewArchitectureEnabled()) { | ||
| 280 | - // If new architecture is enabled, we let you build RN from source | ||
| 281 | - // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. | ||
| 282 | - // This will be applied to all the imported transtitive dependency. | ||
| 283 | - configurations.all { | ||
| 284 | - resolutionStrategy.dependencySubstitution { | ||
| 285 | - substitute(module("com.facebook.react:react-native")) | ||
| 286 | - .using(project(":ReactAndroid")) | ||
| 287 | - .because("On New Architecture we're building React Native from source") | ||
| 288 | - substitute(module("com.facebook.react:hermes-engine")) | ||
| 289 | - .using(project(":ReactAndroid:hermes-engine")) | ||
| 290 | - .because("On New Architecture we're building Hermes from source") | ||
| 291 | - } | ||
| 292 | - } | ||
| 293 | -} | ||
| 294 | - | ||
| 295 | -// Run this once to be able to run the application with BUCK | ||
| 296 | -// puts all compile dependencies into folder libs for BUCK to use | ||
| 297 | -task copyDownloadableDepsToLibs(type: Copy) { | ||
| 298 | - from configurations.implementation | ||
| 299 | - into 'libs' | ||
| 300 | -} | ||
| 301 | - | ||
| 302 | -apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) | ||
| 303 | - | ||
| 304 | -def isNewArchitectureEnabled() { | ||
| 305 | - // To opt-in for the New Architecture, you can either: | ||
| 306 | - // - Set `newArchEnabled` to true inside the `gradle.properties` file | ||
| 307 | - // - Invoke gradle with `-newArchEnabled=true` | ||
| 308 | - // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` | ||
| 309 | - return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" | ||
| 310 | -} | ||
| @@ -1,19 +0,0 @@ | |||
| 1 | -"""Helper definitions to glob .aar and .jar targets""" | ||
| 2 | - | ||
| 3 | -def create_aar_targets(aarfiles): | ||
| 4 | - for aarfile in aarfiles: | ||
| 5 | - name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] | ||
| 6 | - lib_deps.append(":" + name) | ||
| 7 | - android_prebuilt_aar( | ||
| 8 | - name = name, | ||
| 9 | - aar = aarfile, | ||
| 10 | - ) | ||
| 11 | - | ||
| 12 | -def create_jar_targets(jarfiles): | ||
| 13 | - for jarfile in jarfiles: | ||
| 14 | - name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] | ||
| 15 | - lib_deps.append(":" + name) | ||
| 16 | - prebuilt_jar( | ||
| 17 | - name = name, | ||
| 18 | - binary_jar = jarfile, | ||
| 19 | - ) | ||
Binary files do not support preview
| @@ -1,10 +0,0 @@ | |||
| 1 | -# Add project specific ProGuard rules here. | ||
| 2 | -# By default, the flags in this file are appended to flags specified | ||
| 3 | -# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt | ||
| 4 | -# You can edit the include path and order by changing the proguardFiles | ||
| 5 | -# directive in build.gradle. | ||
| 6 | -# | ||
| 7 | -# For more details, see | ||
| 8 | -# http://developer.android.com/guide/developing/tools/proguard.html | ||
| 9 | - | ||
| 10 | -# Add any project specific keep options here: | ||
| @@ -1,13 +0,0 @@ | |||
| 1 | -<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | -<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | - xmlns:tools="http://schemas.android.com/tools"> | ||
| 4 | - | ||
| 5 | - <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
| 6 | - | ||
| 7 | - <application | ||
| 8 | - android:usesCleartextTraffic="true" | ||
| 9 | - tools:targetApi="28" | ||
| 10 | - tools:ignore="GoogleAppIndexingWarning"> | ||
| 11 | - <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" /> | ||
| 12 | - </application> | ||
| 13 | -</manifest> | ||
Rios/RNBackgroundFetch/TSBackgroundFetch.xcframework/ios-arm64_x86_64-simulator/TSBackgroundFetch.framework/_CodeSignature/CodeSignature→harmony/background_fetch/consumer-rules.txt+0-0
Aharmony/background_fetch/src/main/ets/Type.ts+100-0File content is under review, please try again later