question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] No IntentAction/Data on activityResumedEvent

See original GitHub issue

Trying 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
manijakcommented, Feb 6, 2018

@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 new onNewIntent 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 new onNewIntent event, nor the existing activityResumedEvent… 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 the activityResumedEvent also 👍 all this with single instance of my app.

Thanks for your help guys!

1reaction
Plamen5kovcommented, Feb 6, 2018

Hi @manijak, There’s a big chance this PR fixes your issue. You can test it out by installing the tns-core-modules from next 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found