pushwoosh-expo-plugin
v1.0.0
Published
Pushwoosh Expo config plugin
Downloads
1,598
Maintainers
Readme
Expo Pushwoosh Push Notifications module
SUPPORTED ENVIRONMENTS:
- The Expo run commands (
expo run:[android|ios]
)
INSTALL
You need both the pushwoosh-expo-plugin
and the pushwoosh-react-native-plugin
npm package.
npx expo install pushwoosh-expo-plugin
# npm
npm install pushwoosh-react-native-plugin
CONFIGURATION IN app.json / app.config.js
Plugin
Add the plugin to the front of the plugin array.
{
"plugins": [
[
"pushwoosh-expo-plugin",
{
"mode": "development",
}
]
]
}
Plugin Prop
You can pass props to the plugin config object to configure:
| Plugin props | | |
|--------------|--------------|-------------------------------------------------------------------------------|
| mode
| required | Used to configure APNs environment entitlement. "development" or "production" |
Initialize Pushwoosh
import Pushwoosh from 'pushwoosh-react-native-plugin';
Pushwoosh.init({
"pw_appid" : "YOUR_PUSHWOOSH_PROJECT_ID" ,
"project_number" : "YOUR_GCM_PROJECT_NUMBER"
});
Pushwoosh.register();
See Pushwoosh React Native integration
Prebuild (optional)
Prebuilding within Expo entails the generation of native runtime code for the project, resulting in the construction of the 'ios' and 'android' directories. Through prebuilding, the native modules that utilize CocoaPods, autolinking, and other configuration plugins are automatically linked and configured. You can conceptualize prebuild as a bundler for native code.
Executing expo prebuild initiates a custom managed workflow that combines the advantages of both bare workflows and managed workflows simultaneously.
Why is prebuilding recommended?
Prebuilding locally can be beneficial for inspecting changes in config plugins and assisting in the debugging of issues.
Running
npx expo prebuild
RUN
Executing the provided commands will prebuild and run your application. It's important to note that push notifications will not function in the iOS Simulator.
# Build and run your native iOS project
npx expo run:ios
# Build and run your native Android project
npx expo run:android