cengiz-pz / godot-android-deeplink-plugin

Enables application deep link functionality for Android apps
MIT License
6 stars 1 forks source link

Can't get custom uri-scheme deeplink to work #3

Closed PostPollux closed 1 month ago

PostPollux commented 1 month ago

Hi, for some reason I just can't get the deeplinking to work.

I'm trying to redirect a GoogleDrive OAuth link back to the app.

When I call this like stated under "testing" in your short documentation: $ adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "com.postpollux.godotab:/oauth2redirect" I always get this error message:

Starting: Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=com.postpollux.godotab:/... }
Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=com.postpollux.godotab:/... flg=0x10000000 }

I have setup everything as described in the documentation.

Just to verify I had a look at the resulting "Android Manifest.xml":

This is the relevant part in the Manifest that get's generated, and it looks like the DeepLink should be in place:

<activity android:name="com.godot.game.GodotApp" tools:replace="android:screenOrientation,android:excludeFromRecents,android:resizeableActivity" tools:node="mergeOnlyAttributes" android:excludeFromRecents="false" android:screenOrientation="fullUser" android:resizeableActivity="true">
            <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 android:label="" 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="com.postpollux.godotab" android:host="oauth2redirect" android:pathPrefix="" />
</intent-filter>

        </activity>

Also if I run adb shell dumpsys package com.postpollux.godotab | grep -A 20 "android.intent.action.VIEW" to see if it is included in the actual apk on my device I get the following which also indicates that the deeplink should be in place:

 Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "com.postpollux.godotab"
          Authority: "oauth2redirect": -1
          Path: "PatternMatcher{PREFIX: }"
          AutoVerify=true

  Non-Data Actions:
      android.intent.action.MAIN:
        aa75a9 com.postpollux.godotab/com.godot.game.GodotApp filter 223c72e
          Action: "android.intent.action.MAIN"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.LAUNCHER"

Do you see what I'm doing wrong here? Or does the plugin only support deeplinks associated to a domain and not custom uri-schemes like used here?

Any help would be very much appreciated. Thanks!

cengiz-pz commented 1 month ago

Hi @PostPollux, upon first glance I have noticed that you have specified oauth2redirect as the host, however Google's documentation states that oauth2redirect should be part of the path.

PostPollux commented 1 month ago

Thanks for the answer! I finally found the problem. And it works now.

The problem was that I only used one "/" after my custom uri-scheme but i had to use a double slash in the command to verify if the deeplink is working: The following now works:

adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "com.postpollux.godotab://oauth2redirect"