Deep link from notification click not calling Deep link parse activity in particular scenario.


1. We are having two deep links "sports" & "entertainment". Requirement is to take user to specific list as per deep link on click.
2. In onNotificationOpened returning true in both callbacks inside Airship Receiver as i always want launch of app in my control.
3. No pending intent is added in CustomDefaultFactory.
4. Verified deep link is coming correctly. Checked in in inside CustomDefaultFactory using below code 
    

Map<String, ActionValue> actions = message.getActions();



Following steps for scenario. 
Step 1 :  Kill the application with right swipe.

Step 2 : Send push from UA console for "sports" deep link. It will display notification on device. Click on notification will take user to Splash Screen as it was in killed state, then as particular extras are added to intent it will follow next screen and finally launch required screen i.e. CategoryFeedDetail.java  
(No flag added with intent just added extras.)

Step 3 : Pressed back to close this screen and come on home activity which was started after splashActivity before opening required activity.

Step 4 : Now just keep app in background using home button.

Step 5 : Again send push from UA console for same "sports" deep link. Click on notification it will just bring app in foreground. Also verified "IT IS NOT CALLING" parse activity i.e. ParseDeepLinkActivity in this case so my code for opening screen haven't got fired.

Step 6 : Repeat step 4 and keep app in background as you are still on home screen.

Step 7 : Send push from UA console for "entertainment" deep link now. Click on notification works well and takes user to required screen. This time directly started CategoryFeedDetail.java from ParseDeepLinkActivity as app was running and task was already there. (No flag added with intent just added extras.).

Step 8 : Pressed back to close this screen and come on home screen. Tried sending same "entertainment" link many times after that it works well.

Step 9 : Tried again sending push with "sports" deep link it will not work.

Summary : In case app is killed and we use deep link notification to start app. In that case deep link used never calls parse activity again after click on notification. All other works well. 

Your support will be appreciated ! 

Didn't find what you were looking for?

New post

Comments

23 comments

  • Rama,

    Can you clarify why you're returning true in the OnNotificationOpened method? This goes against our recommend best practice when integrating the SDK.

    Returning true in that method prevents Urban Airship from launching the appropriate activity when the app is opened from a push.

    Additionally, have you configured your Deep-Linking strategy as is described in our Deep-Linking for Android documentation?

    0
  • As in case we have deep link we need to give some specific extras to activity. So if UA is going to launch app we can't provide any extra.
    Also i tried returning false, in that case it opens splash screen as expected. In app killed case also it starts splash but when i press home button and launch app from launcher icon it again goes to splash rather than bringing same task in foreground.
    Yes i followed the link for deep linking.

    0
  • This is my code in onNotificatioOpened

    Map<String, ActionValue> actions = notificationInfo.getMessage().getActions();
    if (actions == null || !actions.containsKey(DeepLinkAction.DEFAULT_REGISTRY_NAME) &&
    !actions.containsKey(DeepLinkAction.DEFAULT_REGISTRY_SHORT_NAME)) {
    return false;
    }
    // Return false here to allow Urban Airship to auto launch the launcher
    // activity for foreground notification action buttons
    return true;
    0
  • With this code also when we don't have deep link in message. It always goes through splash screen. But if app once run and we press home button, then started app from launcher icon it still goes to splash rather than bringing running app in foreground. 
    Please consider this also as query.

    0
  • Rama,

    How have you implemented your Splash Screen? This seems more like a problem with the Splash Screen itself rather than Urban Airship. 

    If you have not set up your intents properly, then you're likely to experience situations where it looks like the app is launching again, when that is not your expected behavior. Some of this will likely be in your Android Manifest.

    0
  • Michael

    I am getting your point regarding opening splash again. Please let me know which flag you are adding while starting home screen must be FLAG_ACTIVITY_NEW_TASK as you are providing launcher type behavior. 

    Also i would like to tell i solved this problem of opening splash again & again by using pending intent in CustomDefaultFactory for case we are not having deep link and opening required activity as per my conditions. Also for case we are not having deep link i am returning false from OnNotificationOpened so that UA can start pending intent.It works fine then.

    So only problem left is the main issue in which same deep link never calls ParseDeepLinkActivity. 
    Really appreciate your prompt support !

    0
  • Hi Michael

    Here is update as per my more tries.
    1. Now i am returning false from onNotificationOpened with 3 parameters.
    2. Added pending intents in CustomDefaultfactory for handling cases when there is NO deep link in notification otherwise not doing anything.
    Result : Till now getting same result that main issue in which same deep link never calls ParseDeepLinkActivity which is used to start app in case app was not running in background else all deep links working fine.

    3. Then i tried also returning always false from onNotificationOpened with 2 parameters.
    Result :
    1. When my app is in background, now when i get notification with deep link. On click of that it calls ParseDeepLinkActivity in which i handle deep link but side by it opens Launcher Activity i.e. Splash Screen.
    2. When my app is killed, now when i get notification with deep link. On click of that it calls ParseDeepLinkActivity in which i handle deep link but side by it opens Launcher Activity i.e. Splash Screen. But in this case same deep link which started app works again also. Also every time i click on launcher icon it opens splash.

    NOTE : It should not open launcher screen side by as it is having deep link. It should only call ParseDeepLinkActivity.

    Above is reason i earlier returned true from onNotificationOpened with 2 parameters so that only ParseDeepLinkActivity gets called and i open my required activity. In this case only single problem is coming that same deep link which starts app from killed state does not work again. 


    So these are problems which i am facing for both cases i am returning true/false. 


     

    0
  • Rama,

    Would you be able to send over your code for the following?:

    1) Application Class

    2) ParseDeepLinkActivity

    3) MainActivity

    4) SplashScreen Activity

    5) Android Manifest

     

    I can't quite make out whats wrong without looking at the implementation. I can provide a link to upload your files so we can take a look. Again, I suspect that when the app is being launched from a fresh start, something else is hijacking the start-up processes, in this case being the ParseDeepLinkActivity, so we'll need to figure out which process that is and how to work around it. It could be as simple as changing a few things in the manifest.

    0
  • Okay sure i can provide files. Please share link where i can upload files.

    0
  • Rama,

    I can send an email invite. Is the bizops one you're currently logged into okay? Or is there some other email I should use?

    0
  • you can send invite on aman.sharma@cygrp.com

    0
  • Okay, you should have received an invite. Let me know when you've uploaded the files and I'll take a look and post back here.

    0
  • Hi Michael

    I have uploaded files to shared folder. 
    In place of MainActivity my files name is Feeds.java


    0
  • Rama,

    So, it looks like your ParseDeepLinkActivity is quite a bit different than our provided [sample].

    Mostly, I'm worried about when and where you're calling finish() as that could be prematurely finishing or not finishing the activity when we want it to.

    As a first step, you could change the onCreate() method to reflect what is shown in our sample? Yours should look similar if not the same as our sample.

    0
  • I can't find anything in sample ParseDeepLinkActivity which is not in my activity and can cause this reason. My file will surely be different from your one as i am getting deep link and i want to handle conditions in my way. Then also i seen you sample and found nothing specific to this and which i can change.

    1. As i am finding deep link path in same way as you are finding.

    2. You used switch statement i used if else as per my needs and that should not cause any error. 

    3. If asking for adding check for if (deepLink == null) , i tried but not going inside ever.

    4. And regarding finish my method "openDeepLink()"  its not in any different thread so no chance for any sync issue as all statements are running one after another and finish is surely getting called once "openDeepLink()" returning back. Then also i added removed finish from there and added at completion of method "openDeepLink()" method. But no gain.

    5. I also tried with logs and i am sure that ParseDeepLinkActivity  not getting called in this case. And biggest fact is if e consider ParseDeepLinkActivity not getting killed then how other deep links working. Then no deep link should work at that time.

    6. Also tried overriding onDestroy() method and its getting called every time, also in case of this particular scenario. So its sure nothing wrong with finish

    So main question still persists that why its not calling ParseDeepLinkActivity for same tema again which is called once when app was in killed state. Are you persisting something?

    0
  • Rama,

    For debugging purposes, I would try moving towards using the solution provided in the sample ParseDeepLinkActivity. While, yes, ordinarily your logic should work to deeplink, I'm concerned that they way you have that giant nest of if/else statements could be causing some logic problems that you're not accounting for.

    Please go ahead and use the provided ParseDeepLinkActivity and see if the behavior changes at all. If it does, then it will at least confirm that it has something to do with that implementation. If the behavior does not change after using the provided sample, then we'll need to look elsewhere.

    0
  • Its not giant nested if else its small one !. I am trying as you said. But i can't map nested if else directly to switch statement. 
    1. I added logs and seen logic is going fine.
    2. Then also i will again send you updated file.
    3. Again i am mentioning that class not getting called i added log as first statement in onCreate and checked.

    0
  • I tried as in your sample but its not giving any benefit. I have attached updated file for reference and all logic comments for understanding.

    0
  • Rama,

    If the sample isn't working in this case, then it could have something to do with opening the app from the push, and in this case would be the AirshipReceiver. Do you know if you modified the receiver at all, and if so, could we see what changes those were? It sounds like it may not be auto launching the correct activity, and that could be the reason why the ParseDeepLinkActivity is not working.

    0
  • Hi Michael

    I share that file with you.

    The only change is that OnNotificationOpened method with two params i am returning true in case we have deep link(as that is case where i want to handle launching app) otherwise i am returning false.

    0
  • Shared that file..

    0
  • you can also have look CustomDefaultFactory. I am sending that also.
    I have added pending intent in case we are not having deep links and handling opening of app from there. I already explained that problem of opening splash again and again. which i solved in this way.
    You may read above all messages for getting more sequencing of detail on this.

    0
  • Rama,

    I'm a little confused, and concerned that you're adding new intents in your Notification Builder.

    Your Notification Builder should only be used for displaying the notification and determining what that notification will look like to the user, not figuring whether or not it will deeplink.

    Can you explain what your reasoning behind doing this was? If you look at our recommendations in our documentation, you'll find that we only handle deeplinking in the ParseDeepLinkActivity class, and that we're allowing the launcher activity to fire when the notification is opened, which your app is not currently doing.

    0

Please sign in to leave a comment.