OneSignal / OneSignal-Android-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native Android or Amazon app with OneSignal. https://onesignal.com
Other
591 stars 367 forks source link

[Bug]: deeplink with parameters doesn't work #1718

Closed ahmedgaber1244 closed 9 months ago

ahmedgaber1244 commented 1 year ago

What happened?

i use latest sdk version and app can't use deep link sent with the notification

image

image

it always open main activity but never start the action suppose to happen

that's what i send WhatsApp Image 2023-01-07 at 11 02 33 AM

Steps to reproduce?

1. send notification from one signal dashboard
2. click notification wether app in foreground or background

What did you expect to happen?

use the param sent with notification to open particular screen on my app that's what i send WhatsApp Image 2023-01-07 at 11 02 33 AM

OneSignal Android SDK version

4.8.4

Android version

13, 12, 11, 10

Specific Android models

No response

Relevant log output

No response

Code of Conduct

brismithers commented 1 year ago

Hi @ahmedgaber1244 . It looks like you are using androidx.navigation to control app navigation? Would you be able to provide the AndroidManifest.xml file post-build? As part of the navigation component, it will replace the <nav-graph> element with generated <intent-filter> elements to match all of the deep links in the navigation graph.

The resulting <intent-filter> is what we will need to see to determine why routing isn't happening successfully.

Note I've found this issue which might be related.

Thanks!

ahmedgaber1244 commented 1 year ago

Hi @brismithers i think that's what you need

       <activity
        android:name="hamza.solutions.audiohat.view.activity.MainActivity"
        android:configChanges="orientation|screenSize|screenLayout"
        android:exported="true"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustPan" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <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="https" />
            <data android:host="audiohatdar.com" />
            <data android:path="/app-sharing" />
        </intent-filter>
        <intent-filter android:autoVerify="true" >
            <action android:name="android.intent.action.VIEW" />

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

            <data android:scheme="audiohatapp" />
            <data android:host="pushToBook" />
            <data android:path="/" />
        </intent-filter>
    </activity>

the last intent filter it what you need i guess

ahmedgaber1244 commented 1 year ago

still waiting for your kind reply

m-asadullah commented 1 year ago

@ahmedgaber1244 check your device settings or Go to App Manager and check your app settings. Whether your app allows to open links or not?

ahmedgaber1244 commented 1 year ago

@m-asadullah it's set to be supported Screenshot_2023-01-30-10-03-19-29_fc704e6b13c4fb26bf5e411f75da84f2

brismithers commented 1 year ago

@ahmedgaber1244 can you try this with "Auto Verify" unchecked? I've only seen android:autoVerify="true" on URLs with an http or https scheme. See Android's documentation on auto verification. I suspect you want your AndroidManifest.xml to look something like this:

        <intent-filter  android:autoVerify="true" >
            <action android:name="android.intent.action.VIEW" />

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

            <data android:scheme="https" />
            <data android:host="audiohatdar.com" />
            <data android:path="/app-sharing" />
        </intent-filter>
        <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="audiohatapp" />
            <data android:host="pushToBook" />
            <data android:path="/" />
        </intent-filter>

And your digital asset links JSON file would be at https://audiohatdar.com/.well-known/assetlinks.json

Let me know if this fixes it!

brismithers commented 1 year ago

HI @ahmedgaber1244 can you please let us know if the above suggestion fixed your issue? Thanks!

jennantilla commented 9 months ago

Closing due to no response.

@ahmedgaber1244 feel free to reach out if you are still having issues.

We have also release a new major version of OneSignal with many improvements and enhancements. Check it out here.

Thanks!