Created
March 3, 2020 16:42
-
-
Save cheneytsai/b3c8344370a7e36a6cbf2949a57b5205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Deeplinks should work, as the LauncherActivity is prepared to handle them. Having said that, when starting the application from a deep link the parameter identifying the traffic coming from the Trusted Web Activity won't be appended (eg: &twa=1). So, the traffic coming into the application from a deep link is likely to be counted as regular mobile traffic. | |
it is possible to modify the LauncherActivity to append "&twa=1" in deep links, with something like this: | |
public class CustomQueryStringLauncherActivity extends LauncherActivity { | |
@Override | |
protected Uri getLaunchingUrl() { | |
// Get the original launch Url. | |
Uri uri = super.getLaunchingUrl(); | |
// Append the extra parameter to the launch Url | |
return uri | |
.buildUpon() | |
.appendQueryParameter("twa", "1") | |
.build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment