Skip to content

Commit b1d721b

Browse files
committed
Update readme
1 parent 0ee9a37 commit b1d721b

13 files changed

+84
-16
lines changed

App.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,13 @@ const config = {
6868
// Get your AppID from ZEGOCLOUD Console [My Projects] : https://console.zegocloud.com/project
6969
appID: ,
7070
// Heroku server url for example
71-
// Get the server from: https://github.com/ZEGOCLOUD/dynamic_token_server_nodejs
71+
// Get the server from: https://github.com/ZEGOCLOUD/easy_example_call_server_nodejs
7272
serverUrl: ''
7373
}
7474

7575
class App extends Component {
7676
routesInstance;
7777
messageListener;
78-
backgroundMessageListener;
7978

8079
state = {
8180
userID: '',
@@ -89,7 +88,6 @@ class App extends Component {
8988

9089
componentWillUnmount() {
9190
this.messageListener;
92-
// this.backgroundMessageListener;
9391
}
9492

9593
async onAppBootstrap() {

README.md

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ Clone the easy example Github repository.
3535

3636
#### Modify the project configurations
3737

38-
* You need to modify `appID` to your own account, which can be obtained in the [ZEGO Admin Console](https://console.zegocloud.com/).
39-
* [Generate a Token on your app server (recommended)](https://docs.zegocloud.com/article/11648), provide an interface for the client to call and replace the generateToken method above.
38+
* You need to set `appID` to your own account, which can be obtained in the [ZEGO Admin Console](https://console.zegocloud.com/).
39+
* You need to set `serverUrl` to a valid URL that can be obtained for Zego auth token and post FCM notification request.
4040

41-
> If you are using Heroku for your backen service, you can deploy the token generation service by one click.
41+
> We use Heroku for test backen service, you can deploy the token generation service with one simple click.
4242
>
43-
> [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/ZEGOCLOUD/dynamic_token_server_nodejs)
43+
> [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/ZEGOCLOUD/easy_example_call_server_nodejs)
4444
>
45-
> Once done you will get an url for your instance, try accessing `https://<heroku url>/access_token?uid=1234` to check if it works.
45+
> Once deployed completed, you will get an url for your instance, try accessing `https://<heroku url>/access_token?uid=1234` to check if it works.
4646
>
47-
> Check [dynamic_token_server_nodejs](https://github.com/ZEGOCLOUD/dynamic_token_server_nodejs) for more details.
47+
> Check [easy_example_call_server_nodejs](https://github.com/ZEGOCLOUD/easy_example_call_server_nodejs) for more details.
48+
>
49+
> Note⚠️⚠️⚠️: There are some limitations for Heroku free account, please check this [Free Dyno Hours](https://devcenter.heroku.com/articles/free-dyno-hours) if you want to use Heroku for your production service.
4850
4951

50-
> ![config](media/init.jpg)
52+
> ![config](docs/images/init.jpg)
5153
5254
#### Run on your device
5355
1. For Android
@@ -92,23 +94,29 @@ The following will describe how to build your own project based on this project.
9294
9395
### Copy the source code
9496
95-
Copy the `ZegoExpressManager` folder `img` folder and `App.tsx` files to your typescript project.
97+
Copy the `ZegoExpressManager` folder, `img` folder, `pages` folder and `App.js` files to your project.
9698
97-
> ![project](media/project.png)
99+
> ![project](docs/images/project.jpg)
98100
99101
### Add dependencies to `package.json`
100102
101103
```json
102104
"dependencies": {
103-
"zego-express-engine-reactnative": "^0.17.3"
105+
...
106+
"@notifee/react-native": "^5.2.1",
107+
"@react-native-firebase/app": "^14.9.2",
108+
"@react-native-firebase/messaging": "^14.9.2",
109+
"notifee": "^0.0.1",
110+
"react-native-router-flux": "^4.3.1",
111+
"zego-express-engine-reactnative": "^0.17.3",
104112
}
105113
```
106114
### Grant permission
107115
108-
You need to grant the network access, camera, and microphone permission to make your APP work as except.
116+
You need to grant the network access, camera, microphone and notification permission to make your APP work as except.
109117
110118
#### For iOS
111-
> ![image](media/grant_permission_ios.gif)
119+
> ![image](docs/images/grant_permission_ios.gif)
112120
```plist
113121
<key>NSCameraUsageDescription</key>
114122
<string>We need to use your camera to help you join the voice interaction.</string>
@@ -117,7 +125,7 @@ You need to grant the network access, camera, and microphone permission to make
117125
```
118126
119127
#### For Android
120-
> ![image](media/grant_permission_android.gif)
128+
> ![image](docs/images/grant_permission_android.gif)
121129
```xml
122130
<!-- Permissions required by the SDK -->
123131
@@ -137,7 +145,67 @@ You need to grant the network access, camera, and microphone permission to make
137145
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
138146
<uses-feature android:name="android.hardware.camera" />
139147
<uses-feature android:name="android.hardware.camera.autofocus" />
148+
149+
<!-- Permissions required by notification -->
150+
<application
151+
...
152+
<activity
153+
android:showWhenLocked="true"
154+
android:turnScreenOn="true"
155+
...
156+
```
157+
158+
### Setup FCM and notification(Android)
159+
160+
We use [Firebase FCM](https://firebase.google.com/docs/cloud-messaging) for notification service and use [Notifee](https://notifee.app/) to display the notification content.
161+
162+
#### Setup FCM
163+
164+
1. Go to [Firebase Console](https://console.firebase.google.com/) and create new project if you don't have one.
165+
2. Andd new `Android` app to your Firebase project. Download the `google-service.json` file and move it into your Android app module root directory.
166+
![](docs/images/fcm_android_json_file.jpg)
167+
3. Add the google-services plugin as a dependency inside of your `/android/build.gradle` file:
168+
![](docs/images/google_service_dep.gif)
169+
```xml
170+
buildscript {
171+
dependencies {
172+
// ... other dependencies
173+
classpath 'com.google.gms:google-services:4.3.10'
174+
// Add me --- /\
175+
}
176+
}
177+
```
178+
4. Execute the plugin by adding the following to your `/android/app/build.gradle` file:
179+
![](docs/images/google_service_dep_1.gif)
180+
```xml
181+
apply plugin: 'com.android.application'
182+
apply plugin: 'com.google.gms.google-services' // <- Add this line
183+
```
184+
185+
#### Setup Notifee
186+
187+
1. Add libs configuration for Notifee to your `/android/build.gradle` file:
188+
```xml
189+
allprojects {
190+
repositories {
191+
// ADD THIS BLOCK - this is how Notifee finds its Android library:
192+
maven {
193+
url "$rootDir/../node_modules/@notifee/react-native/android/libs"
194+
}
140195
```
196+
2. Add custom notification sound `call_invite.mp3` into `/android/app/src/main/res/raw/call_invite.mp3`.
197+
> Note⚠️⚠️⚠️: custom notification sound only support `.mp3` file on Android platform
198+
199+
#### Setup backend service
200+
1. Generate `Firebase Admin SDK Private Key`
201+
202+
![Generate Key](docs/images/fcm_admin_sdk_key.gif)
203+
2. Click this deploy button to start deploy your service:
204+
205+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/ZEGOCLOUD/easy_example_call_server_nodejs)
206+
207+
If you are using [Firebase Cloud Functions](https://firebase.google.com/docs/functions), check [this doc](https://firebase.google.com/docs/cloud-messaging/send-message#send-messages-to-specific-devices) for usage and check [this example code](https://github.com/ZEGOCLOUD/easy_example_call_server_nodejs/blob/master/index.js) to make the FCM work with your project.
208+
141209
142210
### Method call
143211

android/app/proguard-rules.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
# http://developer.android.com/guide/developing/tools/proguard.html
99

1010
# Add any project specific keep options here:
11+
12+
-keep class **.zego.** { *; }

docs/images/fcm_admin_sdk_key.gif

3.06 MB
Loading

docs/images/fcm_android_json_file.jpg

170 KB
Loading

docs/images/google_service_dep.gif

389 KB
Loading

docs/images/google_service_dep_1.gif

1.93 MB
Loading
File renamed without changes.

docs/images/init.jpg

835 KB
Loading

0 commit comments

Comments
 (0)