Skip to content

Commit 6e50271

Browse files
authored
Update the push sample app (#211)
* Update the push sample app * Updated README
1 parent ff4a948 commit 6e50271

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,16 @@ public class MainNotificationService extends FirebaseMessagingService {
281281

282282
```
283283

284-
See the [example app](https://github.com/intercom/intercom-react-native/blob/main/example/src/App.tsx) for an example of how to handle deep linking in your app.
284+
Add the following in your `MainActivity`
285+
286+
```kotlin
287+
override fun onNewIntent(intent: Intent) {
288+
super.onNewIntent(intent)
289+
setIntent(intent)
290+
}
291+
```
292+
293+
See the [example app](https://github.com/intercom/intercom-react-native/blob/main/sandboxes/NotificationsSandbox/App.tsx) for an example of how to handle deep linking in your app.
285294

286295
### IOS
287296

sandboxes/NotificationsSandbox/android/app/src/main/java/com/example/sample/MainActivity.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.example.sample
22

3-
import android.os.Bundle;
3+
import android.os.Bundle
4+
import android.content.Intent
45

56
import com.facebook.react.ReactActivity
67
import com.facebook.react.ReactActivityDelegate
@@ -25,4 +26,13 @@ class MainActivity : ReactActivity() {
2526
*/
2627
override fun createReactActivityDelegate(): ReactActivityDelegate =
2728
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
29+
30+
/**
31+
* This method is called when a new intent is received while the activity is running.
32+
* It needs to be added if your app needs to handle deep links opened through push notifications.
33+
*/
34+
override fun onNewIntent(intent: Intent) {
35+
super.onNewIntent(intent)
36+
setIntent(intent)
37+
}
2838
}

sandboxes/NotificationsSandbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"rename": "react-native-rename 'notificationsandbox' --skipGitStatusCheck"
1515
},
1616
"dependencies": {
17-
"@intercom/intercom-react-native": "^7.0.1",
17+
"@intercom/intercom-react-native": "^7.1.3",
1818
"@react-navigation/native": "^6.1.17",
1919
"@react-navigation/native-stack": "^6.9.26",
2020
"react": "18.2.0",

0 commit comments

Comments
 (0)