opening an Instant App by a Firebase Dynamic Link with custom parameters (App Links)

倖福魔咒の 提交于 2019-12-24 19:07:01

问题


I'm searching for a way to open an Android Instant app in a mobile browser. The app supports app links (deep linking in http/https).

My Android app is working as an instant app and can be opened by an app link in different apps that are not browsers (Gmail, Whatsapp, etc.).

I have concluded that the only way to be able to have an instant experience in browser apps is by using Firebase Dynamic Links.

The only way it works is by using short Firebase Dynamic Links (without app parameters in the link). I need to be able to build the link manually with parameters, so the app will know it's desired actions.

In order to use Firebase Dynamic Links, I've:

  1. set up all basic requirements in my app for Firebase Dynamic Links.
  2. set up a sub-domain and enabled it in the Firebase console (the Hosting section).

  3. created a long dynamic link manually (described as the only way to send parameters by link).

example: https://sub.example.com/?link=https://example.com/some-path/file?param1=value1&param2=value2&apn=package.name.com

This long link works (in mobile browsers) only if the app is installed / is in cache. If the app is not installed, the app's play store page opens and offers to install / try it (as instant app).


回答1:


I've contacted Firebase support, and got a solution: Adding the "afl" parameter in the link with the value of the app link.

example: https://sub.example.com/?link=https://example.com/some-path/file?param1=value1&param2=value2&apn=package.name.com&afl=https://example.com/some-path/file?param1=value1&param2=value2




回答2:


The Android app links work properly if the user follows the following steps:

  1. Verify that you are logged into Google, Chrome, and Google play with the account you plan to use for the instant apps.

  2. Go into Google Play Store settings, find the tab for Instant Apps and Enable Instant Apps enable Instant Apps

  3. In your website add html to index.html or the equivalent file where you want to place the embedded link such as this: <!DOCTYPE html> <html> <body> <h2>HTML Links</h2> <p>HTML links are defined with the a tag:</p> <a href="https://example.com/path">This is a link to the instant app</a> </body> </html>

  4. The instant app linking will only work from links embedded within an app such as in gmail or Chrome and not from directly pasting the url in a browser navigation bar.

If you have any questions about this approach, please let me know.



来源:https://stackoverflow.com/questions/56740839/opening-an-instant-app-by-a-firebase-dynamic-link-with-custom-parameters-app-li

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!