Android Deep linking: Use the same link for the app and the play store

前端 未结 4 947
醉梦人生
醉梦人生 2020-11-28 02:43

I have a website which enables the user to make a search query. The query might take some time to complete (minutes to days), and I would like to enable the user to download

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-28 03:20

    You can try using this scheme(to be sent to the user):

    intent://details?id=X&url=Y&referrer=Z#Intent;scheme=market;action=android.intent.action.VIEW;package=com.android.vending;end";
    

    X: Package name of the App

    Y: Deep link scheme which should be defined in the App's manifest. (Please refer this) Here, they have used this URL as an example: "http://www.example.com/gizmos" , therefore Y should be replaced by this URL.

    Z: Can be any data which you want to pass to the App via Google Play. Please take note that any data which you pass should not be '&' separated because the original parameters are itself '&' separated.

    From what I experimented, this URL is understood by the browser and it redirects you to the App based on the package name and the deep-link scheme. Else it takes you to the Google Play.

    PS: The Google Play makes a broadcast to the app. So make sure you receive the broadcast in a receiver.

提交回复
热议问题