Skip to content

Commit 045858b

Browse files
authored
Create installation.android.md
1 parent 04e369f commit 045858b

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

docs/installation.android.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Android Installation
2+
3+
The simplest way of installing on Android is to use React Native linker:
4+
5+
```
6+
react-native link react-native-firestack
7+
```
8+
9+
## Manually
10+
11+
To install `react-native-firestack` manually in our project, we'll need to import the package from `io.fullstack.firestack` in our project's `android/app/src/main/java/com/[app name]/MainApplication.java` and list it as a package for ReactNative in the `getPackages()` function:
12+
13+
```java
14+
package com.appName;
15+
// ...
16+
import io.fullstack.firestack.FirestackPackage;
17+
// ...
18+
public class MainApplication extends Application implements ReactApplication {
19+
// ...
20+
21+
@Override
22+
protected List<ReactPackage> getPackages() {
23+
return Arrays.<ReactPackage>asList(
24+
new MainReactPackage(),
25+
new FirestackPackage() // <-- Add this line
26+
);
27+
}
28+
};
29+
// ...
30+
}
31+
```
32+
33+
We'll also need to list it in our `android/app/build.gradle` file as a dependency that we want React Native to compile. In the `dependencies` listing, add the `compile` line:
34+
35+
```java
36+
dependencies {
37+
compile project(':react-native-firestack')
38+
}
39+
```
40+
41+
Add to `AndroidManifest.xml` file
42+
```diff
43+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
44+
+ <service android:name="io.fullstack.firestack.FirestackMessagingService">
45+
+ <intent-filter>
46+
+ <action android:name="com.google.firebase.MESSAGING_EVENT"/>
47+
+ </intent-filter>
48+
+ </service>
49+
50+
+ <service android:name="io.fullstack.firestack.FirestackInstanceIdService" android:exported="false">
51+
+ <intent-filter>
52+
+ <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
53+
+ </intent-filter>
54+
+ </service>
55+
```

0 commit comments

Comments
 (0)