-
-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathCustomTabsActivity.java
More file actions
35 lines (26 loc) · 1.09 KB
/
CustomTabsActivity.java
File metadata and controls
35 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package io.sentry.samples.android;
import android.net.Uri;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.browser.customtabs.CustomTabColorSchemeParams;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.core.content.ContextCompat;
public class CustomTabsActivity extends AppCompatActivity {
private static final String DEMO_URL = "https://www.sentry.io/";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabColorSchemeParams params =
new CustomTabColorSchemeParams.Builder()
.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary))
.build();
builder.setDefaultColorSchemeParams(params);
builder.setShowTitle(true);
builder.setShareState(CustomTabsIntent.SHARE_STATE_ON);
builder.setInstantAppsEnabled(true);
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(DEMO_URL));
finish();
}
}