[Android] No IntentAction/Data on activityResumedEvent
See original GitHub issueTrying to get the DeepLinks or DynamicLinks to work on Android. Not sure if this is an issue or just my configuration & usage. But I have noticed that the issue is the same on a pair of plugins trying to do the same (firebase plugin and url-handler).
Tell us about the problem
When listening to the activityResumedEvent
on Android, the getAction()
& getData()
return null. Even tho the ActivityManager logs the new intent with all the data.
This is my intent config:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="myurl"/>
<data android:scheme="https"/>
<data android:scheme="http"/>
</intent-filter>
Also added this to my main activity android:launchMode="singleTask"
Code in app.ts:
application.android.on(application.AndroidApplication.activityResumedEvent, (args: application.AndroidActivityEventData) => {
var intentData = args.activity.getIntent().getData();
console.log("------>>>>>> IntentAction: " + args.activity.getIntent().getAction());
console.log("------>>>>>> IntentData: " + intentData);
});
So when trying to open a dynamicLink from another app, the app opens, but the intent data is null, so we cannot fetch the url and parse it.
ActivityManager: START u0 {act=android.intent.action.VIEW dat=https://XXXXX.app.goo.gl/... flg=0x3000000 cmp=com.myapp/com.tns.NativeScriptActivity (has extras)} from uid 10070
JS: ------>>>>>> IntentAction: null
JS: ------>>>>>> IntentData: null
Which platform(s) does your issue occur on?
Android
Please provide the following version numbers that your issue occurs with:
- CLI: 3.4.1
- Cross-platform modules: 3.4.0
- Runtime(s): 3.4.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Intents and Intent Filters - Android Developers
Each intent filter specifies the type of intents it accepts based on the intent's action, data, and category. The system delivers an implicit...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Plamen5kov, Thanks for the tip. This looks promissing. I implemented the code in my app and also the demo app from @tsonevn and tested.
On the demo-app, I tried installing the
@next
version of tns-core-modules. I checked that the newonNewIntent
code was added. But when running the app, it seems like no events are hit. Could be something else in the modules that is causing this. But I did not get any hit in the newonNewIntent
event, nor the existingactivityResumedEvent
… strange. Delete the entire hooks, platforms, node_modules prior to test.Decided then to test on my app, but without installing the
@next
version of modules. Just added the new function manually in the activity.android.js file, and ran the app. This time it worked! The events are hit, and I get the needed data in theactivityResumedEvent
also 👍 all this with single instance of my app.Thanks for your help guys!
Hi @manijak, There’s a big chance this PR fixes your issue. You can test it out by installing the
tns-core-modules
fromnext
although, I’m not sure they’re compatible with your project. Another alternative is to temporary do the fix provided in the PR locally and try to build.