Multiple subdomain support with App Links - android

I've been reading the docs for supporting app links for android and the website my app supports works with subdomains but there's too many subdomains and they are built dynamically. I was wondering if there is a way to support many subdomains without having to specifiy them all in the intent-filter tag.
Here is the link to the example from google: http://developer.android.com/training/app-links/index.html#request-verify
The example is in the Supporting app linking for multiple subdomains location.
I thought a regex would work but apparently that's not supported when defining the host. I don't want to list all of them since that would mean having to push a new release with every new subdomain created
<activity ...>
<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=".*.example.org" />
<data android:pathPattern="/.*" />
</intent-filter>
</activity>
I would prefer not to use a third party lib or service.. But any suggestions that work for you would be appreciated to understand how to make this work.

Quoting from: Verify Android App Links
Alternatively, if you declare your hostname with a wildcard (such as *.example.com), you must publish your assetlinks.json file at the root hostname (example.com). For example, an app with the following intent filter will pass verification for any sub-name of example.com (such as foo.example.com) as long as the assetlinks.json file is published at https:/ /example.com/.well- known/assetlinks.json:
<application>
<activity android:name=”MainActivity”>
<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>
</application>
It seems the previous answers are outdated and Android now does has a support for wildcard in host name. As per the documentation it is now supported.

the website my app supports works with subdomains but there's too many subdomains and they are built dynamically
You are welcome to implement app links for some subset of those (e.g., the ones that are known at the time you build the app). You might even consider cooking up a Gradle plugin that can generate the appropriate manifest elements from a list of domains somewhere.
However, the domains are checked at install time, and there is no means to add new domains except by shipping a new edition of the app with a new manifest.
I was wondering if there is a way to support many subdomains without having to specifiy them all in the intent-filter tag.
No, sorry. Android checks the domains and retrieves the JSON file at install time.
I thought a regex would work but apparently that's not supported when defining the host
You cannot download JSON from a regex.
I don't want to list all of them since that would mean having to push a new release with every new subdomain created
Then either support some common subset, or do not support app links for now. It is conceivable, if somewhat unlikely IMHO, that Google will offer more flexible options for this in the future.
UPDATE: 2019-11-08: It appears that wildcards are supported as of Android 7.1.

You can add your domain as *.example.com. At the docs it's said that the wildcard can be used as the first character of the host. So you could change the manifest to something like this:
<intent-filter . . . >
<data android:scheme="https" />
<data android:host="*.example.org" />
. . .
</intent-filter>
And this should work with the subdomains:
example.org
www.example.org
anyOtherSubDomain.example.org

After multiple test, multiple subdomains supported since android 7.1 (api level 25).
On previous version during app installation we got this error : E/HostsVerifier: Invalid host to verify (*.example.org):Input host is not valid.

Related

Firebase dynamic link for not installed application

I have a problem with dynamic link at Firebase not redirecting me to Play Store if the application is not installed.
The dynamic link is defined as following:
The link preview (debug) show following picture:
according to this one if I click on the link and application is not installed I would be brought to Play Store. However it just opens a browser and opens the web link. The "Play Store" link though is functioning and brings me to the Play Store.
One more detail. When I click on the dynamic link on my Android phone I see three steps:
A browser window with "google.com" URL opens shortly.
Browser window is closed and I see original screen where I clicked on the link with a ring rotating for less than a second.
A browser windows opens again but this time with web link opened
And same happens even if the application is installed.
Is there a way to debug this behavior and get some better understanding of what's the reason?
The AndroidManifest.xml is defined as following:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />
<application
android:label="myapp"
android:name="${applicationName}"
android:icon="#mipmap/icon">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- Deep linking -->
<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="http" />
<data android:scheme="https" />
<data android:host="myapp.com" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
As you mentioned it is in debug , i believe here that application is not present on playstore right now and that's why it is not redirecting you to playstore in case of app is not installed on your device but yes , it should open your app if it is already installed on your device
so make sure above scenario .. if flow is working same as mentioned then no worries everything is fine but if it is not working as mentioned then you need to mention code of creating link , manifest file , activity where you are handling it etc ..
So, it turned out my approach to dynamic links building was wrong. Dynamik link creation as shown in the question is a way to establish static links that don't change and have no parameters. It's usable to bring users to a specific part of your application that never changes.
In case of using dynamic link, which is dynamic in its nature like in my case - invitation link that allows to install application if it's not yet installed, run it and bring the user to a specific part of the application with parameters would be:
Define a URL prefix
Publish the application at Play Store at least in closed testing mode. Internal testing seems not to be enough because it's available only by internal testing ID and not the package ID.
Generate URL of type: https://myapp.page.link/?link=https://myapp.com/join/invitation_id&apn=com.myapp
That is enough to make work for Android. For iOS it's not tackled yet.

Why was my Android automotive app category not approved?

I have been trying to publish an Android automotive application to Google Play Store, but it was rejected. The reason for the rejection was "App category not permitted. At this time, we are only accepting apps within categories supported by the Android for Cars App Library as well as the Media and Video categories."
The categories referenced above are Media apps (audio), Messaging apps, Navigation apps, Point of Interest (POI) apps and Video apps (https://developer.android.com/training/cars#supported-app-categories).
In our AndroidManifest.xml file, the category is defined like this :
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="androidx.car.app.category.POI" />
</intent-filter>
<meta-data android:name="distractionOptimized" android:value="true" />
</activity>
So my question is, why does it say it was rejected due to "..only accepting apps within categories supported by the Android for Cars App Library as well as the Media and Video categories", when the category for the application is one of these categories?
I tried to appeal, but it says it can take up to 7 days, and it would be great knowing why as soon as possible.
I have tried to search for an answer, but I have not found anything in particular.
The only thing I noticed, was that other people put their category inside , like this:
<service
android:name=".MyCarAppService"
android:exported="true">
<intent-filter>
<action android:name="androidx.car.app.CarAppService"/>
<category android:name="androidx.car.app.category.POI"/>
</intent-filter>
</service>
However, I have found that this is not always the case. An example in the documentation which does not use the (https://developer.android.com/reference/androidx/car/app/activity/CarAppActivity), says:
"The class representing a car app activity in the main display. This class is responsible for binding to the host and rendering the content given by its androidx.car.app.CarAppService."
And in the example provided, the code looks like this:
<activity
  android:name="androidx.car.app.activity.CarAppActivity"
  android:exported="true"
  android:launchMode="singleTask"
  android:label="#string/your_app_label">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
  <meta-data android:name="distractionOptimized" android:value="true"/>
</activity>
So my question remains; why does my app get rejected due to "not having a supported category", when the category is set to one of the five supported categories?
Final answer:
Check your androidx.car.app library version to determine which category to use if you're building a Point-Of-Interest app:
Lower than 1.3: Use PARKING or CHARGING categories.
1.3 and up: Use POI category
We ended up using the new IOT category as that suited our app best, it worked with version 1.2 of the CarApp library, it passed the review for open testing (1.3 wasn't available yet on Xamarin at the time of writing this update).
*** Original post: ***
Unfortunately, this seems to be a common problem a lot of people are having that are trying to publish Android Auto apps. See this Stack Overflow thread.
I'm also using the "androidx.car.app.category.POI" category since my app definitely does not fall under any of the other categories. Out of the 7 submissions I've done, only 3 have been approved so far, it seems the approvals are very sporadic. The rejection always has the same generic rejection message ("App category not permitted"). When you appeal the rejection, they just respond with the same rejection message.
New categories can be requested for Android Auto using this URL.
Edit:
This Stack Overflow thread suggested using the PARKING category instead of POI. Which is interesting because according to Google's Android for cars docs, the PARKING and CHARGING categories have been deprecated and should use POI instead now. I tried it and my build got approved.

Sign-in with "Accounts in this organizational directory only - single tenant" not work with MSAL Android library

We are having a serious problem when trying to log in via Azure AD Single-tenant.
We've read many forums and many other issues and no solution or answer seems to explain how to correctly configure a native android application, using msal library, to work as it should.
The error says that we are using an incompatible endpoint, but there is no way to force an endpoint in the current configuration of the msal.config file. We are currently with our hands tied.
We did all the setup correctly. We chose "Accounts in this organizational directory only - single tenant" in Supported Account Types.
We configure the return URLs using package name + sha when adding the Android platform.
We configured msal_config.json as shown:
{
"client_id": "my-client-id",
"redirect_uri": "msauth://my-package-name/sha",
"broker_redirect_uri_registered": true,
"authorities": [
{
"type": "AAD",
"audience": {
"type": "AzureADMyOrg",
"tenant_id": "my-tenant-id"
},
"default": true
}
]
}
We configure the intent-filter in android manifest as shown:
<activity
android:name="com.microsoft.identity.client.BrowserTabActivity">
<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="msauth"
android:host="my-package-name"
android:path="/sha" />
</intent-filter>
</activity>
It was expected that the token would be returned and the login process would complete.
The login process runs well halfway through. The app correctly opens the Microsoft login screen, you can fill in the user's email and password, but when you go to login, this error appears in the android LOG:
Application 'my-tenant-id-here'(PORTAL_APPGAMIFICATION) is not configured as a multi-tenant application. Usage of the /common endpoint is not supported for such applications created after '10/15/2018'. Use a tenant-specific endpoint or configure the application to be multi-tenant.
We don't want multi-tenant. We don't want any logins that aren't from within our organization's directory. It makes no sense to reconfigure Azure AD to "multi-tenant", the library should work fine with the single-tenant option.

Error in preview a container in tagmanager in android

I integrated the tagmanager in android for adwords conversion tracking. I want to test the container in preview mode. So I did all the things described on the google's developer page here.
I included the complete code needed for preview the container. But when I tried to launch the app from QR scanner or the link provided by tagmanager for preview.
It says:
sorry we cannot open this link. there is not any apps installed which can handle it.
Is anything I have to do except the above mentioned things.
Stumbled upon similar problem. Solved by correctly reading the manual. Steps I did:
Add this to your android manifest file and replace your information:
<activity
android:name="com.google.android.gms.tagmanager.PreviewActivity"
android:label="#string/app_name"
android:noHistory="true"> <!-- optional, removes the previewActivity from the activity stack. -->
<intent-filter>
<data android:scheme="YOUR WHOLE APP PACKAGE NAME" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/>
</intent-filter>
</activity>
then go to GTM administration website -> container versions -> your current version -> actions -> preview and enter your WHOLE package name into the box. "eg. com.example.mygtm"
then proceed to open the link, copy adb command or scan QR code.
Hope this helps !

Cannot receive search queries from Google Now

I am trying to connect Google Now SEARCH_ACTION with my searchable activity using this piece of code in my AndroidManifest.xml:
<activity android:name=".SearchableActivity">
<intent-filter>
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
I am following instructions on http://android-developers.blogspot.com/2014/10/the-fastest-route-between-voice-search.html and https://developer.android.com/guide/components/intents-common.html#SearchOnApp.
This is just not working. The search from Google Now is not launching my app. I have verified that:
This works for Eat 24 app, confirming that there's no issue with right version of OS/Google app/Locale.
I can launch app from inside my app and receive typed search queries, confirming that my SearchableActivity code doesn't have any issues.
Anyone has gotten this to work? Could you please let me know what I am missing here?
Well... looks like the app needs to be published on Play Store:
https://plus.google.com/+AndroidDevelopers/posts/afSRdDQiy1N - look for comments by Jarek Wilkiewicz. Going to try this next.

Categories

Resources