1

For now on by saying Huawei devices, we understand devices release after may 16 2019, that are released without Google Mobile Services

During the development to support app links on Huawei, several problems have been occurred and following questions raised:

  1. Why google app links doesn't work on Huawei?
  2. How to support them on Huawei devices?
  3. How to get data shared via app link
Hayk Nahapetyan
  • 4,452
  • 8
  • 42
  • 61

3 Answers3

4

Q: Why google app links doesn't work on Huawei?

A: App links are considered to be deep links with an extra check. That extra check done by GMS, which requires assetlinks.json file to be under your domain, in order your domain be authorized to directly open the app, more info here.

Q: How to support them on Huawei devices?

A: You need to have account on AG Connect, then apply for any prefix you like. Then AG Connect will generate a URL for you, which will be something like https://YOUR_PREFIX_HERE.dra.agconnect.link. After having this, you should add deeplink parameter to your URL which should be exact same app link URL that you were using for devices with GMS. Important thing is that it should be URL encoded e.g. https://YOUR_PREFIX_HERE.dra.agconnect.link?deeplink=urlencoded(https.my-host-here.my_prefix-if-I-have&some-data-toshare= SOME-DATA-IN-BASE-64).

Having the same url used for GMS app link, as a deep link in case of HMS, makes you to have single intent filter to handle both app links.

In short: HMS.applink = https://YOUR_PREFIX_HERE.dra.agconnect.link?deeplink=urlencoded(GMS.applink).

Q: How to get data shared via app link

A: In the HMS documentation it suggests to ad AG Connect applinking library to the project and use appropriate classes. But fortunately we can do it in the same way as we do for GMS app links: we can get data from Intents.

Hayk Nahapetyan
  • 4,452
  • 8
  • 42
  • 61
0
  1. Why google app links doesn't work on Huawei?

For a GMS-based phone, the GMS API needs to be called to bind the domain name and app during app installation. However, the API cannot be accessed normally from mainland China. For a HMS-based phone, the GMS API is not called to bind the domain name and app during app installation. Instead, the assetlinks.json file on the website of the app is verified. Therefore, the app links service is supported on HMS-based phone. Note that the underlying technology of Huawei app linking is based on Android app links and iOS universal links. However, Huawei app linking provides the following additional functions:

•   Support all platforms

•   Support short links

•   Support deferred deep links
  1. How to support them on Huawei devices? You need to have a Huawei Developer Account, and then create an app and project in the Huawei AppGallery Connect. Huawei app linking supports the link creation in multiple ways:

    1). Creating a link in AppGallery Connect, please refer to link.

    2). Creating a link by calling APIs on the client, please refer to Link.

    3). Manually constructing a link, please refer to Link

  2. How to get data shared via app link You can receive a link on the client via a shared app link, please refer to Link

Zinna
  • 1,947
  • 2
  • 5
  • 20
  • Several things I don't agree. "However, the API cannot be accessed normally from mainland China" - There is no GMS on device, so it's not connected with country. – Hayk Nahapetyan Feb 17 '21 at 09:31
  • get data from app link is done in your mentioned SharedAppLink project by using AgLinking library, which is totally redundant when you can do it via Intent. Why to attach extra library? – Hayk Nahapetyan Feb 17 '21 at 09:36
  • No need to create app in AppGallery connect. Only project is enough, as you only need to request a prefix. That's the problem with Huawei, it asks dummy requirements that not really needed. – Hayk Nahapetyan Feb 17 '21 at 09:38
  • Hi Hayk, yeah it's a lot of info. to digest in my answer, but it's important to follow the steps for the app link to work. I've checked, my answer should have covered all your questions already. Best – Zinna Feb 17 '21 at 18:41
0

For a GMS-based phone, the GMS API needs to be called to bind the domain name and app during app installation. However, the API cannot be accessed normally from mainland China. For a HMS-based phone, the GMS API is not called to bind the domain name and app during app installation.

mags
  • 1