Update README.md
This commit is contained in:
72
README.md
72
README.md
@@ -14,15 +14,12 @@
|
||||
### iOS
|
||||
|
||||
Select the root of your project. Select Capabilities tab. Enable Background Modes and enable the following mode:
|
||||
|
||||
|
||||
Background fetch
|
||||
|
||||
Background processing (🆕 iOS 13+; Only if you intend to use BackgroundFetch.scheduleTask)
|
||||
- Background fetch
|
||||
|
||||
<img width="997" alt="68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f3976696b356b786f6b6c6b36336f622f696f732d73657475702d6261636b67726f756e642d6d6f6465732e706e673f646c3d31" src="https://user-images.githubusercontent.com/66774568/112835897-2c728c80-909a-11eb-8b4e-9dc8ad3471fb.png">
|
||||
|
||||
Configure Info.plist (iOS 13+)
|
||||
#### Configure Info.plist (iOS 13+)
|
||||
|
||||
Open your Info.plist and add the key "Permitted background task scheduler identifiers"
|
||||
<img width="512" alt="68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f7435786667616832676768717477732f696f732d73657475702d7065726d69747465642d6964656e746966696572732e706e673f646c3d31" src="https://user-images.githubusercontent.com/66774568/112835629-cf76d680-9099-11eb-8359-b87fb417a922.png">
|
||||
@@ -31,8 +28,73 @@ Add the required identifier com.transistorsoft.fetch.
|
||||
|
||||
<img width="512" alt="68747470733a2f2f646c2e64726f70626f7875736572636f6e74656e742e636f6d2f732f6b7764696f327272323536643835322f696f732d73657475702d7065726d69747465642d6964656e746966696572732d6164642e706e673f646c3d31" src="https://user-images.githubusercontent.com/66774568/112835829-16fd6280-909a-11eb-87f4-42a6cff4e025.png">
|
||||
|
||||
#### AppDelegate.m (iOS 13+)
|
||||
```diff
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import <React/RCTBridge.h>
|
||||
#import <React/RCTBundleURLProvider.h>
|
||||
#import <React/RCTRootView.h>
|
||||
|
||||
+//IMPORTANT: Paste import ABOVE the DEBUG macro
|
||||
+#import <TSBackgroundFetch/TSBackgroundFetch.h>
|
||||
|
||||
#if DEBUG
|
||||
.
|
||||
. ///////////////////////////////////////////////////////////////////////////////////
|
||||
. // IMPORTANT: DO NOT paste import within DEBUG macro or archiving will fail!!!
|
||||
. ///////////////////////////////////////////////////////////////////////////////////
|
||||
.
|
||||
#endif
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
.
|
||||
.
|
||||
.
|
||||
+//[REQUIRED] Register BackgroundFetch
|
||||
+[[TSBackgroundFetch sharedInstance] didFinishLaunching];
|
||||
|
||||
return YES;
|
||||
}
|
||||
```
|
||||
|
||||
### Android
|
||||
|
||||
#### android/build.gradle
|
||||
```diff
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
||||
url("$rootDir/../node_modules/react-native/android")
|
||||
}
|
||||
maven {
|
||||
// Android JSC is installed from npm
|
||||
url("$rootDir/../node_modules/jsc-android/dist")
|
||||
}
|
||||
+ maven {
|
||||
+ // react-native-background-fetch
|
||||
+ url("${project(':react-native-background-fetch').projectDir}/libs")
|
||||
+ }
|
||||
|
||||
}
|
||||
}
|
||||
```
|
||||
#### Configure proguard-rules.pro
|
||||
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).
|
||||
|
||||
1. Edit `android/app/proguard-rules.pro`.
|
||||
2. Add the following rule:
|
||||
|
||||
```bash
|
||||
# [react-native-background-fetch]
|
||||
-keep class com.transistorsoft.rnbackgroundfetch.HeadlessTask { *; }
|
||||
```
|
||||
|
||||
|
||||
## Issues, suggestions and feature requests
|
||||
https://github.com/IncentroBA/backgroundTask/issues
|
||||
|
||||
|
||||
Reference in New Issue
Block a user