Local Notificatio does not redirect to the app to excute

Aniruddha's Avatar

Aniruddha

20 Feb, 2016 04:22 PM

Me and my team have managed to get the local notification but clicking the notification does not direct it towards the sdk so it is not able to execute the action. Please help.

  1. 1 Posted by michal.gasztold on 23 Mar, 2016 04:15 PM

    michal.gasztold's Avatar

    Hello,

    We are sorry for this very delayed answer.

    In general when auto user notifications are enabled the action will be performed only if any is defined (open web url, deep link, samsung wallet ). If none of the actions is defined for your rule in the BO , then simply nothing will automatically happen. Moreover if you want to handle a payload json of the rule it is available in the delegate method called ruleFiredForEvent at the moment of the rule being triggered (not when the user clicks the notification).

    You can also handle the event in a completely custom way. The flow is slightly different then so to get more details please read the following doc:
    https://github.com/Ubudu/Android-SDK/blob/master/ubudu-sdk-user-man...

    Let us know if we can help more.

  2. 2 Posted by gautam on 01 Jul, 2016 02:06 PM

    gautam's Avatar

    we have created a deeplink in our manifest file

    but its not working

    kind tell us where we have to define the deeplink url in our manager panel

  3. 3 Posted by michal.gasztold on 10 Aug, 2016 10:07 AM

    michal.gasztold's Avatar

    Hello,

    All you have to do to use a deeplink type rule is to define the proper URL in your rule's Actions section (see the attached screenshot). There is no need to do anything in your apps manifest.

    This will work if you handle events in a default way on your app side which means that you do not call mBeaconManager.setEnableAutomaticUserNotificationSending(false); anywhere in the Ubudu SDK configuration.

    On the other hand, If you want to handle events in a custom way (you call the method mentioned above) you can handle deeplink in your UbuduAreaDelegate implementation as presented below:

    @Override
    public void notifyUserForEvent(UbuduEvent event) {
        if (event instanceof UbuduBeaconRegionEvent)
            notifyUserForEvent((UbuduBeaconRegionEvent) event);
    }
    
    public boolean notifyUserForEvent(final UbuduBeaconRegionEvent event) {
            if(event.notification().deepLinkUrl()!=null && !event.notification().deepLinkUrl().equals("")) {
                Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(event.notification().deepLinkUrl()));
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    
                PackageManager packageManager = mContext.getPackageManager();
                List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    
                boolean isIntentSafe = activities.size() > 0;
    
                if (isIntentSafe == true) {
                    mContext.startActivity(intent);
                } else {
                    com.ubudu.sdk.util.Log.w(TAG,"There is no app installed for handling this deep link");
                }
            }
    }
    

    i hope this will help.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac