3

我用火力地堡的動態鏈接,它可以打開我的應用程序,去演商店或去一個URL。但是當我通過鏈接傳遞一些參數時,我只能得到第一個參數。 這裏是我的動態鏈接:通行證通過火力地堡動態多PARAMS鏈接的Android

https://xx.app.goo.gl/?link=http://xx.com/?usn=abc&pass=def&apn=com.xx&afl=http://google.com 

而且我用這個代碼來獲取鏈接:

// Build GoogleApiClient with AppInvite API for receiving deep links 
     mGoogleApiClient = new GoogleApiClient.Builder(this) 
       .enableAutoManage(this, this) 
       .addApi(AppInvite.API) 
       .build(); 

     // Check if this app was launched from a deep link. Setting autoLaunchDeepLink to true 
     // would automatically launch the deep link if one is found. 
     boolean autoLaunchDeepLink = false; 
     AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink) 
       .setResultCallback(
         result -> { 
          if (result.getStatus().isSuccess()) { 
           // Extract deep link from Intent 
           Intent intent = result.getInvitationIntent(); 
           String deepLink = AppInviteReferral.getDeepLink(intent); 
           Logger.e(deepLink); 
          } 
         } 
       ); 

和日誌打印:http://xx.com/?usn=abc(通= DEF丟失了) 任何解決這個問題?

回答

7

您需要URL encode參數link的值,否則系統將無法確定動態鏈接的參數是什麼以及動態鏈接的參數link的子參數是什麼。

這意味着最終的URL看起來應該像https://xx.app.goo.gl/?link=http%3A%2F%2Fxx.com%2F%3Fusn%3Dabc%26pass%3Ddef&apn=com.xx&afl=http://google.com

重要提示:如果你是(我懷疑)試圖通過明文鏈路參數傳遞用戶名和密碼,這是一個非常糟糕的主意。嚴重,不這樣做。閱讀this answer,以獲得適合這種要求的方法。

+0

謝謝,我會檢查它。美國/通過只是爲了測試目的:D – maphongba008

+0

它的工作原理,非常感謝。 – maphongba008

+0

請幫助這個類似的問題:http://stackoverflow.com/q/42119692/6144372 –