https://github.com/transistorsoft/react-native-background-fetch/
- Add the following to
plugins
:
{
"expo": {
"name": "your-app-name",
"plugins": [
+ "react-native-background-fetch"
]
}
}
- Add the following
UIBackgroundModes
andBGTaskSchedulerPermittedIdentifiers
to theios.infoPlist
section:
{
"expo": {
"name": "your-app-name",
"plugins": [
"react-native-background-fetch"
],
"ios": {
+ "infoPlist": {
+ "UIBackgroundModes": [
+ "fetch",
+ "processing"
+ ],
+ "BGTaskSchedulerPermittedIdentifiers": [
+ "com.transistorsoft.fetch"
+ ]
+ }
}
}
}
- If you intend to execute your own custom tasks via
BackgroundFetch.scheduleTask
, you must add those custom identifiers as well to theBGTaskSchedulerPermittedIdentifiers
. For example, if you intend to execute a customtaskId: 'com.transistorsoft.customtask'
, you must add the identifiercom.transistorsoft.customtask
toBGTaskSchedulerPermittedIdentifiers
:
"BGTaskSchedulerPermittedIdentifiers": [
"com.transistorsoft.fetch",
+ "com.transistorsoft.customtask"
]
com.transistorsoft.
— In the future, the com.transistorsoft
prefix may become required.
BackgroundFetch.scheduleTask({
taskId: 'com.transistorsoft.customtask',
delay: 60 * 60 * 1000, // In one hour (milliseconds)
});
You must rebuild your Android app for the added plugins to be evaluated.
- If you're developing locally:
npx expo prebuild
- If you're using Expo EAS:
eas build --profile development --platform android
eas build:configure
eas build --profile development-simulator --platform ios --local
作成できた tar.gz ファイルを解答し、app をシミュレーターへ drop する
eas build --profile development --platform android --local
eas build --profile preview --platform ios --local
apple configurator で転送
eas build --profile preview --platform android --local
android file transfer で転送
もしくは、Google Drive 経由で実機へ転送