sefidgaran / salesforce-marketing-cloud

Salesforce Marketing Cloud MobilePush Flutter SDK
https://pub.dev/packages/sfmc_plugin
MIT License
6 stars 21 forks source link

setHandler method does not work for Android #17

Closed nvl-santamaria closed 7 months ago

nvl-santamaria commented 8 months ago

I see you've added a comment in the code:-

" /// (Applicable to iOS only - pass URL to Flutter through 'handle_url' methodCall.method - refer to example)"

How shall I make it work for Android as well ?

My requirement is to capture the url send from "Open Direct" and then navigate to that screen in the app.

ifelsebreak commented 8 months ago

For Android you can handle the url that gets passed with the notification directly in the AndroidManifest.xml, between the activity tags:

    <meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
    <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="myscheme" android:host="myurl.com" />

    </intent-filter>

This will open the app when the user taps a notification that has the url myscheme://myurl.com

nvl-santamaria commented 7 months ago

Thanks allot @ifelsebreak That worked 👍