Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

Android deepLink Listener not getting called.

PK Shiu

Hi,

I have a react native app, where we have integrated the Android SDK natively and subclassed `Autopilot` as you have described.  Takeoff is called from the native side.

I am trying to configure the app to handle deeplinks, everything is working great on iOS side with UrbanAirship.addListener('deepLink', onLink); however onLink is not getting called on android. 

I have tried adding an intent filter like;
 
<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:scheme="@string/app_link_scheme" android:host="@string/app_link_host" android:pathPrefix="@string/app_link_prefix" />
</intent-filter>

but still no luck.

Am I missing some configuration?

Also, your docs (https://docs.airship.com/platform/android/getting-started/) describe...

airship.setDeepLinkListener(deepLink -> {
// Handle the deepLink
return true;
});

I think this documentation needs to be updated as this method does not exist.. 

 

Thanks,

Please sign in to leave a comment.

0
Avatar

Hi PK,

May I ask if you have already taken a look at the Airship github repository? Here is a link to the react-native-module that contains the addListener method:

https://github.com/urbanairship/react-native-module

With that being said, I'm not seeing where you can pass that onlink argument when calling 'addAndroidListener' as it only accepts one a string for the event name, which in your case is called 'deeplink':

void addAndroidListener(String eventName) { ... }

Looking forward to your response...

Kind regards,
Chilun Liu
Senior Technical Support Engineer
Airship

The Embassy Tea House, 195-205 Union Street, London, SE1 0LN
Portland | San Francisco | London | Paris | New York | New Delhi

chilun liu 0 votes
Comment actions Permalink
0
Avatar

Hi Chilun,

Quick reminder this is a react native project.

I kind of realized last night that initializing airship from native android does not work so well, I tested with your prescribed airshipconfig.properties file and everything works as expected.  Interestingly, I am able to takeoff on native iOS and iOSReactModule seems to be ok with it and everything works.  

Android was difficult because I subclasses Autopilot to configure, which it looks like UrbanAirshipReactModule (android) does as well, then, on a prayer, I tried to subclass ReactAutopilot, but to no avail.  

This app will have the need to point to several different Airship instances.  Because of that, a monolithic airshipconfig.properties is problematic.

Is there any way to specify the location/name of the airshipconfig.properties file to UrbanAirshipReactModule?

or

Is there a way to use createAirshipConfigOptions to configure airship keys/secrets for UrbanAirshipReactModule (android)?

 

We will only need to be dynamic at build time, no run time environment switches.

Hope this is clear, thanks

 

 

PK Shiu 0 votes
Comment actions Permalink
0
Avatar

Also, I realized that AirshipReactNative is using AirshipAndroid version 9.7.1 which explains why airship.setDeepLinkListener does not exist and your documentation is current.

 

Lots of moving parts...

PK Shiu 0 votes
Comment actions Permalink
0
Avatar

Chilun,

 

Why are you asking me to do upgrade?

 

Have you confirmed that on the new version one can call takeoff from the native side and the AirshipReactModule will be able to play nicely with that?

PK Shiu 0 votes
Comment actions Permalink
0
Avatar

Hi Chilun,

 

Just wanted to circle back.  I never upgraded but got this working by subclassing ReactAutopilot, my fatal mistake from before, was not calling super.onAirshipReady(airship)

Now everything is working as expected.

Darn careless mistakes.  

Thankyou!

PK Shiu 0 votes
Comment actions Permalink