I'm having an android app that is having an instant app version. My instant app can be launched & run without installation from deep link. This is how my deep domain assetlinks.json looks like:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.<app name>",
"sha256_cert_fingerprints":
["<app fingerprint>"]
}
}]
It is working fine, but what I want to achieve is to have "fallback" web application when user would have disabled instant apps or have older device. I've tried to host react.js web application on this domain with assetlinks.json file in public folder(to make it available) and it was not working at all, android phone treated this domain as usual website and instant app was not launching like on previous configuration. Same thing goes for hosting empty index.html file. It is also breaking instant app invocation process. Any ideas this this can be configured ?
this is how instant app invocation screen looks like
Alright, I've managed to find a solution, it is pretty easy one. My deep links most of the time have data passed as path such as /type/value. The solution is to create clear index.html file with javascript attached like this:
<script>
window.location.href = '<FALLBACK WEB APP URL>' +
window.location.pathname;
</script>
This code extracts path from the deep link and adds it to web app link. Next, index.html needs to be served for every folder of deep domain, but domain needs to also allow to read assetlinks.json file if needed. This solution work pretty well with instant apps - it is not breaking invocation process, and is is also compatible with iOS AppClips.
Related
I have integrated firebase authentication with email in my android app. I have two domain url prefix in dynamic links section. By default, firebase always sends link with first domain url prefix. I tried setting domain url prefix in code by this method -
actionCodeSettings.setDynamicLinkDomain(getString(R.string.dynamic_link_url))
but it gives error of The provided dynamic link domain is not configured or authorized for the current project Please advice correct way of acheiving this. Thanks in advance.
if you added a new URL prefix different from the first one you need to manually update Firebase hosting release history
you can do it by using firebase CLI
make sure firebase cli is installed
firebase login and select your project
run firebase init
make sure during project initialization, from the Firebase CLI
prompts:to select to set up Hosting and Functions
Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
continue with the default option
once setup is completed it will generate public folder contained index.html 404.html, .firebaserc and firebase.json
then modify the firebase.json and add the following
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"appAssociation": "AUTO",
"rewrites": [ { "source": "/links/**", "dynamicLinks": true }, { "source": "/share/**", "dynamicLinks": true } ]
}
}
enter code here
firebase deploy
please note that links and share are our 2 prefix you can change name to any you want and also note this prefix can be used by different subdomains as well
I'd doing basically the same as in the question, but just in Flutter setting the dynamicLinkDomain property in the ActionCodeSettings using the EmailLinkProvider
eg.
dynamicLinkDomain: 'mysuperapp.page.link',
and it seems to work fine.
I did NOT have to do anything with Firebase CLI updating the hosting history as was suggested in the answer from #fadi-abo-msalam
Given that Flutter would be using the same underlying Android Firebase SDK, perhaps this has been fixed since this question was first asked and it now works for native Android apps as well.
I have the Medium app install on my iPhone.
When doing a search on Google Chrome app, when I clicks on a medium.com link in the search results, it open my Medium app.
How can this happen? How can Google Chrome can interpret https://medium.com to medium://?
So the feature in particular you are referring to is Universal Links and requires both server side and client side modifications.
On the server side / website you need to add an AASA (Apple App Site Association) file. This file is simply a JSON file that contains the specific applinks urls for the corresponding app identifier. A sample is shown below.
{
"applinks": {
"apps": [],
"details": [{
"appID": "ABCDEBBQ.com.medium.ios",
"paths": ["*"]
}]
}
}
If you note the paths key in the JSON above you will see that there is a star or wildcard symbol. This simply means open any URL on my websites’ domain. For example www.medium.com/topposts will open in the medium iOS app. It should be noted that you can explicitly define your paths to either include or exclude.
On the client side (Xcode) you’ve gotta setup the associated domains capability inside of your application and specify the applinks service for your domain in this case www.medium.com
Lastly you’ve gotta add the capability to your application identifier inside of the developer portal.
After all of this configuration is completed you should now have a ‘link’ between your website and application.
Apple handles all of this logic internally in iOS and since it’s closed source I cannot give you the exact implementation details but the just of it is that when you visit the domain (medium.com) on your iOS device it downloads the AASA file from the webserver (the AASA file must be hosted on a secure server and can only be downloaded over HTTPS) and the operating system then checks whether there is a corresponding application on the device that matches the appId specified in the AASA file. If both the paths and appIds match it then launches the medium iOS application on the phone.
That’s how it works. I hope that I’ve articulated it well enough.
I have generated and loaded a Google Digital Asset Links(DAL) file to https://myexample.com/.wellknown/assetlinks.json. Read and execute perms are set. The file is below:
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.myexample.testqiew2.app",
"sha256_cert_fingerprints":
["7A:D5:67: ... :E9:5E"]
}
}]
The robots.txt file does not block access, and I am in the US.
The AppLink Assistant in Associate website passes the first three checks but fails on the fourth with: Digital Asset Links file not found at https://myexample.com/.wellknown/assetlinks.json"
The Statement List Generator and Tester responds with "No app deeplinking permission found for com.myexample.testqiew2.app at myexample.com".
I have searched through android-instant-apps, android-studio, and android tags and haven't found other ways to prove the file I know is there is accessible.
I even tried:
https://digitalassetlinks.googleapis.com/v1/statementslist:list?source.web.site=https//quixr.com&relation=delegate_permission/common.handle_all_urls
but got a Google 404.
I have not uploaded code to the Play Store yet. I am still just trying to verify the infrastructure is in order. Is there any other way I can test why the DAL file is not being seen even though it is there?
Thanks guys. It turned out that, after I became convinced there weren't any more cracks for anything to have fallen through, I started wondering if there were redirects going on at the server. There I found that the document root needed to be changed in conjunction with installing the SSL certificate. Changing that so /.well-known branched off the root made the DAL file accessible. The AppLinks Assistant accessed it, and so did the StatementListGenerator.
So it was the server, not the AIA configuration at all. Thanks again for your help.
After all these years I migrated to a different hosting service. I was surprised that there was no /.well-known directory with the assetlinks.json file in it. Yet the App Links Assistant worked fine and so, apparently, did the app.
I found assetlinks.json in the /public_html directory which functions as the root for my domain. In this intervening time, it looks like the InstantApp system has accepted that location. So don't worry that you can't find .well-known.
I'm trying to implement an 'add to homescreen' banner using Google Chrome's native banner support, with this demo as reference.
https://googlechrome.github.io/samples/app-install-banner/basic-banner/index.html
According to the spec there, the requirements are:
the page uses a service worker (yep, see below)
the site is using HTTPS (yep, the site has a valid SSL certificate and I am loading over HTTPS. chrome shows the site as secure and has a green padlock, no errors or warnings in the certificate)
the app has a manifest declared (yep, see below)
the manifest has a short_name, 144 pixel icon and a type of 'image/png' (yep, see below)
The manifest I am using is below.
{
"name": "Web app test",
"short_name": "Test",
"icons": [
{
"src": "/resources/launcher-icon-3x.png",
"sizes": "144x144",
"type": "image/png"
}
],
"display": "standalone"
}
Which contains a short_name and a 144 pixel icon of type image/png.
The service worker I am using is a direct copy & paste of this code:
https://github.com/GoogleChrome/samples/blob/gh-pages/service-worker/custom-offline-page/service-worker.js
which was recommended in this article:
https://developers.google.com/web/updates/2015/03/increasing-engagement-with-app-install-banners-in-chrome-for-android?hl=en
The service worker has been registered, the manifest is being loaded into the page and the image url is correct, but the banner is not showing.
I also have the chrome://flags/#bypass-app-banner-engagement-checks enabled so this isn't a case of me needing to come back tomorrow and check that it works. I have been able to view homescreen banners on all of Chrome's demos that I have checked (which is where I took most of this code from) and my phone has the latest version of Chrome installed.
Is there anything else I am missing that could be blocking the homescreen banner from appearing?
Thanks.
A couple of things to check:
Ensure you have a start_url in your manifest that defines the page to launch.
Ensure that you have a <link rel=manifest> in your page
Ensure the image URL's all resolve correctly based on the manifest location
Preferably have a 192px icon, 144 is the minimum
Mounir Lamouri has created a manifest validator that you can use to check your manifest is correct.
You should also enable chrome://flags/#bypass-app-banner-engagement-checks if you are using Chrome so that you get a quicker warning or visibility of any issues. Finally you can look in the Dev Tools console on any page load and an error will be shown indicating why the banner wasn't shown.
There is also a lot of guidance on developers.google.com
Using App Install Banners
Create a manifest file including a short_name, icons and launch_url
Link to the manifest file from the page
Web App Install Banner
Optionally include extra information such as the background_color and theme_color.
Listening to events on App Install banner
Learn when Chrome thinks it can prompt for install and then offer the ability to defer it until a more appropriate time.
Understand if the user has accepted or rejected the prompt by looking at the response in the onbeforeinstallprompt event.
In general I'd recommend pasting your manifest into this to ensure it doesn't have any errors: http://mounirlamouri.github.io/manifest-validator/
If using Chrome with chrome://flags/#bypass-app-banner-engagement-checks enabled, you can look in the console on any page load and an error will be shown indicating why the banner wasn't shown.
My question may sound like "already asked", but I cannot find any answer. My problem is :
I have a phonegap app that only display a remote website (that website is responsive and work perfectly on mobile device). So the app is very simple :
function onBodyLoad() {
document.addEventListener("deviceready", function(){
location.href = "http://www.mydomain.com/";
}, true);
}
As you can see this I just a redirection when that app starts. With that method I have no access to phonegap API after the redirection (am I right?).
My question(s) is: is that method the right method? How can I display/hide element on a webpage depending on the webpage is accessed by the app or by mobile browsers?
Thank you so much
Greg
Just be aware that you are not allowed to do this from Apple.
From the App Store Review Guideline
2.12 Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may
be rejected