Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android deep linking is not working

Tags:

android

Android deep linking is not working
===================================
 Android link:-notification://id=notificationid

1:-In manifest

      <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                    <category android:name="android.intent.category.BROWSABLE" />

                    <data
                        android:host="id"
                        android:scheme="notification" />
                </intent-filter>       

2:-and coding side

 @Override
        protected void onResume() {
            super.onResume();        
            Intent intent = getIntent();
            String string=intent.getAction();
            Uri data = intent.getData();
            Log.d("hello","cgbdsuyfdkv");
        }   

but its not working please any body can help me !!!!!

like image 241
Ashutosh Srivastava Avatar asked Aug 03 '26 03:08

Ashutosh Srivastava


1 Answers

You can simply modify your url

Android link:-notification://id=notificationid instead of
Android link:-notification://page?id=notificationid  //page is host name
I tried a lot and find out this is working for me.
  1. manifest code

               <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.BROWSABLE" />
    
                <data
                    android:host="page"
                    android:scheme="notification" />
            </intent-filter>       
    

2.java code #get your notification id here

Intent intent = getIntent();
    String string = intent.getAction();
    Uri data = intent.getData();
    if (data != null) {
        String path = data.getPath();
        String path1 = data.getPath();
        providerUrl = intent.getData().toString();
        UrlQuerySanitizer sanitizer = new UrlQuerySanitizer();
        sanitizer.setAllowUnregisteredParamaters(true);
        sanitizer.parseUrl(providerUrl);
        String id = sanitizer.getValue("id");
        if (id != null)
            Log.d("notification id", id);
    }
like image 151
Shiv Kumar Avatar answered Aug 05 '26 18:08

Shiv Kumar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!