Merge branch 'master' of https://github.com/invertase/react-native-firebase
This commit is contained in:
commit
24738dd03f
|
@ -40,12 +40,11 @@ RNFirebase aims to replicate the Firebase Web SDK as closely as possible. Becaus
|
||||||
* [Firebase Setup](docs/firebase-setup.md)
|
* [Firebase Setup](docs/firebase-setup.md)
|
||||||
* API
|
* API
|
||||||
* [Authentication](docs/api/authentication.md)
|
* [Authentication](docs/api/authentication.md)
|
||||||
|
* [Realtime Database](docs/api/database.md)
|
||||||
* [Analytics](docs/api/analytics.md)
|
* [Analytics](docs/api/analytics.md)
|
||||||
* [Storage](docs/api/storage.md)
|
* [Storage](docs/api/storage.md)
|
||||||
* [Realtime Database](docs/api/database.md)
|
|
||||||
* [ServerValue](docs/api/server-value.md)
|
|
||||||
* [Messaging](docs/api/cloud-messaging.md)
|
* [Messaging](docs/api/cloud-messaging.md)
|
||||||
* [Events](docs/api/events.md)
|
* [Crash](docs/api/crash.md)
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Android Installation
|
# Android Installation
|
||||||
|
|
||||||
The simplest way of installing on Android is to use React Native linker:
|
The simplest way of installing on Android is to use the react-native link CLI command & rebuild the project:
|
||||||
|
|
||||||
```
|
```
|
||||||
react-native link react-native-firebase
|
react-native link react-native-firebase
|
||||||
|
@ -38,24 +38,45 @@ dependencies {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Add to `AndroidManifest.xml` file
|
Add the project path to `android/settings.gradle`:
|
||||||
```diff
|
|
||||||
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
|
|
||||||
+ <service android:name="io.invertase.firebase.RNFirebaseMessagingService">
|
|
||||||
+ <intent-filter>
|
|
||||||
+ <action android:name="com.google.firebase.MESSAGING_EVENT"/>
|
|
||||||
+ </intent-filter>
|
|
||||||
+ </service>
|
|
||||||
|
|
||||||
+ <service android:name="io.invertase.firebase.RNFirebaseInstanceIdService" android:exported="false">
|
|
||||||
+ <intent-filter>
|
|
||||||
+ <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
|
|
||||||
+ </intent-filter>
|
|
||||||
+ </service>
|
|
||||||
```
|
|
||||||
|
|
||||||
Add to `android/settings.gradle`
|
|
||||||
```
|
```
|
||||||
include ':react-native-firebase'
|
include ':react-native-firebase'
|
||||||
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
|
project(':react-native-firebase').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-firebase/android')
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you plan on using [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging/), add the following to `android/app/src/main/AndroidManifest.xml`.
|
||||||
|
|
||||||
|
Add permissions:
|
||||||
|
```
|
||||||
|
<manifest ...>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
```
|
||||||
|
|
||||||
|
Set app [launch mode](https://inthecheesefactory.com/blog/understand-android-activity-launchmode/en) inside application props:
|
||||||
|
```
|
||||||
|
<application
|
||||||
|
...
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
>
|
||||||
|
```
|
||||||
|
|
||||||
|
Add messaging service:
|
||||||
|
```
|
||||||
|
<application ...>
|
||||||
|
<service
|
||||||
|
android:name="io.invertase.firebase.messaging.MessagingService"
|
||||||
|
android:enabled="true"
|
||||||
|
android:exported="true">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
<service android:name="io.invertase.firebase.messaging.InstanceIdService" android:exported="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
|
||||||
|
</intent-filter>
|
||||||
|
</service>
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue