{"id":16126038,"url":"https://github.com/rreusser/react-native-android-intent-issue","last_synced_at":"2025-09-09T06:37:20.806Z","repository":{"id":145193354,"uuid":"56643525","full_name":"rreusser/react-native-android-intent-issue","owner":"rreusser","description":"A repo to demonstrate an issue with out-of-the-box intents in React Native","archived":false,"fork":false,"pushed_at":"2016-04-21T18:24:13.000Z","size":4334,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T13:14:37.709Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rreusser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-20T00:59:17.000Z","updated_at":"2016-08-26T16:12:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"06040c56-6c27-45a1-a323-00b272d382df","html_url":"https://github.com/rreusser/react-native-android-intent-issue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rreusser/react-native-android-intent-issue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rreusser%2Freact-native-android-intent-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rreusser%2Freact-native-android-intent-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rreusser%2Freact-native-android-intent-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rreusser%2Freact-native-android-intent-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rreusser","download_url":"https://codeload.github.com/rreusser/react-native-android-intent-issue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rreusser%2Freact-native-android-intent-issue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260083861,"owners_count":22956408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-09T21:35:00.598Z","updated_at":"2025-06-16T02:07:10.768Z","avatar_url":"https://github.com/rreusser.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# android-intent-issue\n\nSee: https://github.com/facebook/react-native/issues/7079\n\nThis repo illustrates an issue with out-of-the-box deep linking in React Native for Android. Each deep link creates a new activity. The [Android `\u003cactivity\u003e` docs](http://developer.android.com/guide/topics/manifest/activity-element.html) indicate that default \"`standard`\" behavior is:\n\n\u003e The system always creates a new instance of the activity in the target task and routes the intent to it.\n\nThe solution is to add `launchMode` to the main activity definition:\n\n```xml\n    \u003cactivity\n      android:name=\".MainActivity\"\n      android:launchMode=\"singleTask\"\n    ...\n```\n\nAccording to the docs for `singleTask` mode,\n\n\u003e The system creates the activity at the root of a new task and routes the intent to it. However, if an instance of the activity already exists, the system routes the intent to existing instance through a call to its onNewIntent() method, rather than creating a new one.\n\nThis approach fixes the issue but requires additional hookup to route the [`onNewIntent`](http://developer.android.com/reference/android/app/Activity.html#onNewIntent(android.content.Intent)) event through `RCTDeviceEventEmitter` in a manner that completes the missing implementation of [`Linking.addEventListener`](http://facebook.github.io/react-native/docs/linking.html#addeventlistener) for React Native.\n\n## To reproduce\n\n1. Open the app\n2. Click the button to illustrate changed state\n3. Open a deep link via `npm run link` or\n\n  ```\n  adb shell am start -a android.intent.action.VIEW -d 'androidintentissue://testtest' com.androidintentissue\n  ```\n\n4. Click the hardware back button and verify that the original instance of the activity is exposed.\n\n\n\n![Example](./example.gif)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frreusser%2Freact-native-android-intent-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frreusser%2Freact-native-android-intent-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frreusser%2Freact-native-android-intent-issue/lists"}