Skip to content

Commit

Permalink
Update the push sample app (#211)
Browse files Browse the repository at this point in the history
* Update the push sample app

* Updated README
  • Loading branch information
liutingdu authored Jun 17, 2024
1 parent ff4a948 commit 6e50271
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,16 @@ public class MainNotificationService extends FirebaseMessagingService {

```

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.
Add the following in your `MainActivity`

```kotlin
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
}
```

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.

### IOS

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.sample

import android.os.Bundle;
import android.os.Bundle
import android.content.Intent

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
Expand All @@ -25,4 +26,13 @@ class MainActivity : ReactActivity() {
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)

/**
* This method is called when a new intent is received while the activity is running.
* It needs to be added if your app needs to handle deep links opened through push notifications.
*/
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
}
}
2 changes: 1 addition & 1 deletion sandboxes/NotificationsSandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"rename": "react-native-rename 'notificationsandbox' --skipGitStatusCheck"
},
"dependencies": {
"@intercom/intercom-react-native": "^7.0.1",
"@intercom/intercom-react-native": "^7.1.3",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"react": "18.2.0",
Expand Down

0 comments on commit 6e50271

Please sign in to comment.