Skip to content

Instantly share code, notes, and snippets.

@andreban
Created February 10, 2019 12:07
Show Gist options
  • Save andreban/e0e10588b8cfe7931993822291ef3245 to your computer and use it in GitHub Desktop.
Save andreban/e0e10588b8cfe7931993822291ef3245 to your computer and use it in GitHub Desktop.
Changing Status Bar colour when launching a TWA
// Copy LauncherActivity from the support library repo
// (https://github.com/GoogleChrome/custom-tabs-client/blob/master/customtabs/src/android/support/customtabs/trusted/LauncherActivity.java#L153-L155)
// and replace the getCustomTabsIntent method, as below:
protected CustomTabsIntent getCustomTabsIntent(CustomTabsSession session) {
return new CustomTabsIntent.Builder(session)
.setToolbarColor(Color.parseColor("#000000"))
.build();
}
@andreban
Copy link
Author

You could override the getLaunchingUrl to return Uri.parse("https://www.example.com/");

Do you mind posting the question on StackOverflow? (https://stackoverflow.com/questions/tagged/trusted-web-activity/). It will make easer for other developers with the same issue to find the answer (and other people can help with the answer too).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment