Java Code Examples for android.support.customtabs.CustomTabsClient#getPackageName()

The following examples show how to use android.support.customtabs.CustomTabsClient#getPackageName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ManageDataLauncherActivity.java    From custom-tabs-client with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    String chromePackage = CustomTabsClient.getPackageName(this,
            TrustedWebUtils.SUPPORTED_CHROME_PACKAGES, false);
    if (chromePackage == null) {
        onError(new RuntimeException("No valid build of Chrome found"));
        finish();
        return;
    }

    View loadingView = createLoadingView();
    if (loadingView != null) {
        setContentView(loadingView);
    }

    CustomTabsClient.bindCustomTabsService(this, chromePackage, mServiceConnection);
}
 
Example 2
Source File: HassActivity.java    From home-assistant-Android with GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("RestrictedApi")
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (menu instanceof MenuBuilder) {
        ((MenuBuilder) menu).setOptionalIconsVisible(true);
    }
    String packageName = CustomTabsClient.getPackageName(this, null);
    CustomTabsClient.bindCustomTabsService(this, !TextUtils.isEmpty(packageName) ? packageName : "com.android.chrome", chromeConnection);
    getMenuInflater().inflate(R.menu.hass, menu);
    return super.onCreateOptionsMenu(menu);
}
 
Example 3
Source File: SettingsActivity.java    From home-assistant-Android with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    //noinspection ConstantConditions
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    String packageName = CustomTabsClient.getPackageName(this, null);
    CustomTabsClient.bindCustomTabsService(this, !TextUtils.isEmpty(packageName) ? packageName : "com.android.chrome", chromeConnection);
}