Deeplink empty path error: "android:path cannot be empty" - android

I'm trying to configure deeplinks for my app. I configured several options like:
https://myapp.com/news ---> NewsActivity
https://myapp.com/history ---> HistoryActivity
with intent filters like:
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:pathPrefix="/news" />
</intent-filter>
and
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:pathPrefix="/history" />
</intent-filter>
I also want a link pointing from the base domain to my main activity
https://myapp.com ---> MainActivity
I want the link to respond to the base domain but no to other links like: https://myapp.com/playlists since the playlist features is not currently implemented in the app and is better to redirect to the web.
But when I set the intent filter:
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:path="" />
</intent-filter>
I receive the following lint warning:
android:path cannot be empty
Ensure the URL is supported by your app, to get installs and traffic
to your app from GoogleSearch.
More info: https://g.co/AppIndexing/AndroidStudio
Despite this warning, the behavior it is correct. How can I fix this warning?

Had the same issue, you can just ignore the warning with tools:ignore="AppLinkUrlError"
So your intent would be:
<intent-filter android:label="MyApp">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http"
android:host="myapp.com"
android:path=""
tools:ignore="AppLinkUrlError" />
</intent-filter>
Add xmlns:tools="http://schemas.android.com/tools" to your initial manifest tag if it's not already there.

Related

How to create intent for Firebase Android Tester App to open app when there is an update

If Our internal users are using Firebase's App Tester app to test staging builds of our app, Is it possible to launch an intent to direct the user to that place inside the app? We have logic to direct the user to the play store to update on hard update requirement, but that doesn't work in staging, so we're looking to send the user to the Tester App directly and to then ideally open the details of the activity showing new version for download.
I've analyzed the APK ang to the following:
<activity
android:theme="#ref/0x7f130129"
android:name="dev.firebase.appdistribution.main.MainActivity"
android:exported="true">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</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="https" />
<data
android:host="appdistribution.firebase.google.com" />
<data
android:pathPrefix="/testerapps/" />
</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="https" />
<data
android:host="appdistribution.firebase.google.com" />
<data
android:pathPattern="/testerapps/.*/releases/.*" />
</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="https" />
<data
android:host="appdistribution.firebase.google.com" />
<data
android:pathPrefix="/accept/" />
</intent-filter>
</activity>
I feel like I'm just forgetting how to use intents properly, but I have the suspicion that
<data
android:scheme="https" />
<data
android:host="appdistribution.firebase.google.com" />
<data
android:pathPattern="/testerapps/.*/releases/.*" />
is what I'm looking for, but I'm having the dangest time forming the intent to correctly open the app and direct the person to the app I want, any suggestions?

Oculus Go file association with intent filter

I want all files of my type (.xxx) to be open with my application on an Oculus Go.
For that I have tried a lot of things in my AndroidManifest.xml file. For now, I have all these intent filters in the main activity :
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.xxx" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.xxx" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-compressed" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/x-zip-compressed" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/zip" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="multipart/x-zip" />
</intent-filter>
The 4 intent filters with a mime type are for zip files. It's because my file type is ".zip" file renamed to ".xxx".
I have downloaded a .xxx file with the oculus browser and then click on it on the right panel. Nothing happened ...
I also tried with a zip file. Nothing happened ...
Is it possible to do a file association on Oculus Go ?
Am I doing something wrong ?
Thanks in advance.
TL;DR No, this is not supported yet.
Oculus Browser doesn't launch intents for downloaded items. It does open video files; it handles video files as a special case.

Android. Deep linking doesn't work with http/https scheme

I added a deep linking to my Android app this way:
<activity
android:name=".views.DeepLinkingActivity"
android:exported="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="https"
android:host="example.com"/>
</intent-filter>
</activity>
When I click on https://example.com I get redirected to the web site.
When I change android:scheme="https" to android:scheme="appscheme" it works and it redirects me to my app.
How to force my app to be opened via https scheme?
UPDATE
I added a subdomain and it still doesn't work.
<activity
android:name=".views.DeepLinkActivity"
android:exported="true">
<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"
android:host="www.example.ru"/>
</intent-filter>
</activity>
Thanks to veritas1 I removed android:autoVerify="true" from https-scheme. I also changed the scheme from https to http. (You can read about autoVerify).
So, currently have two different schemes:
<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:host="your-site.com"
android:pathPrefix="/"
android:scheme="http"
/>
</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:host="your-site.com"
android:pathPrefix="/"
android:scheme="myapp"
/>
</intent-filter>
When clicking on a link myapp://your-site.com/... an application will be opened. When clicking on http://your-site.com/... Chrome browser will offer to open in the application or another browser, while other mobile browsers ignore this and try to open themselves.
UPDATE
See https://stackoverflow.com/a/60342565/2914140 for App Linking.
Hi please use the following data and try also refer this doc
<intent-filter>
<data
android:scheme="ou unique scheme(appname,package name)" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
OR
<data
android:scheme="you unique scheme(appname,package name)"
android:host="www.example.ru"/>
You refer to deep linking but android:autoVerify="true" is used for App linking, so the domain example.com (which you don't own?) is going to get checked for a digital asset links json file. See https://developer.android.com/training/app-links/index.html
For your test to work I'd suggest removing android:autoVerify="true" and adding a subdomain to the host e.g. android:host="www.example.com"
Try this
<activity
android:name=".views.DeepLinkingActivity"
android:exported="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:host="open"
android:scheme="example" />
</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:host="example.com"
android:pathPrefix="/"
android:scheme="http" />
</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:host="example.com"
android:pathPrefix="/"
android:scheme="https" />
</intent-filter>
</activity>
Please check below it may be help
https://codelabs.developers.google.com/codelabs/android-deep-linking/index.html?index=..%2F..%2Findex#0
Just use http. Don't know when the implementation is changed.
But I just tested that using http will make both http and https work.
So change you intent filter by:
<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="http"
android:host="example.com"/>
</intent-filter>
youe can also add to it
sub.example.com
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="example.com" />
<data android:scheme="app" android:host="com.example.example" />
</intent-filter>

how to open this app via my website

<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="olacabs.com" android:pathPrefix="/app/launch" />
<data android:scheme="olacabs" android:host="app" android:pathPrefix="/launch" />
</intent-filter>
this is the manifest file of an android app ! how to open this app via my website?
for example i opened linkedin app using this code
Linkedin
same way i need to open above app also ! how to do that . i have tried with
OLA
OLA
OLA
please help me , thanks in advance
I'm not sure if you have figured out by now, but the correct way to have the same activity handle 2 or more URIs is to have multiple intent-filters:
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="http" android:host="olacabs.com" android:pathPrefix="/app/launch" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="olacabs" android:host="app" android:pathPrefix="/launch" />
</intent-filter>

Path pattern for intent-filter

I want to launch Android application on clicking URL (may be in e-mail or SMS).
How to write different path patterns for these two URL?
http://www.hostname.com/folder1/file.ext
http://www.hostname.com/folder1/folder2/file.ext
I want to launch my activity only from the first URL, not the second one. Currently I am using this intent-filter but it's launching my app with both URL.
<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:host="www.hostname.com"
android:pathPattern=".*\\/folder1/*"
android:scheme="http" />
</intent-filter>
Try below code
<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:host="www.hostname.com"
android:pathPrefix="/folder1"
android:scheme="http" />
</intent-filter>

Categories

Resources