How to access and pass parameters to the modules of an Android Instant App

前端 未结 3 2145
-上瘾入骨i
-上瘾入骨i 2020-12-17 15:02

With normal installed apps it\'s possible to use the technique of Deep Linking in order to not only open a specific application from an URL but also to redirect it to

3条回答
  •  萌比男神i
    2020-12-17 15:37

    In order to do that, you have to use the "app links assistant" in Tools->App Links Assistant

    Then check your links and, in the Path selector, check that the "pathPrefix" option is selected.

    Then at the bottom of the OnCreate method of your activity (which is related to the link you recently edited) add this code:

    Intent appLinkIntent = getIntent();
    String appLinkAction = appLinkIntent.getAction();
    Uri appLinkData = appLinkIntent.getData();
    // then use appLinkData.getQueryParameter("YourParameter")
    

    You can test and debug this, using the "editConfigurations" option, just open that window and edit your instantApp module (the one launched with the Link you recently edited) and in the URL field add the URL parameters that you need. (then just run that module :D )

    Hope this to be helpful.

提交回复
热议问题