Java Code Examples for android.app.Activity#unbindService()
The following examples show how to use
android.app.Activity#unbindService() .
These examples are extracted from open source projects.
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 Project: Telegram-FOSS File: Browser.java License: GNU General Public License v2.0 | 6 votes |
public static void unbindCustomTabsService(Activity activity) { if (customTabsServiceConnection == null) { return; } Activity currentActivity = currentCustomTabsActivity == null ? null : currentCustomTabsActivity.get(); if (currentActivity == activity) { currentCustomTabsActivity.clear(); } try { activity.unbindService(customTabsServiceConnection); } catch (Exception ignore) { } customTabsClient = null; customTabsSession = null; }
Example 2
Source Project: TelePlus-Android File: Browser.java License: GNU General Public License v2.0 | 6 votes |
public static void unbindCustomTabsService(Activity activity) { if (customTabsServiceConnection == null) { return; } Activity currentActivity = currentCustomTabsActivity == null ? null : currentCustomTabsActivity.get(); if (currentActivity == activity) { currentCustomTabsActivity.clear(); } try { activity.unbindService(customTabsServiceConnection); } catch (Exception ignore) { } customTabsClient = null; customTabsSession = null; }
Example 3
Source Project: Telegram File: Browser.java License: GNU General Public License v2.0 | 6 votes |
public static void unbindCustomTabsService(Activity activity) { if (customTabsServiceConnection == null) { return; } Activity currentActivity = currentCustomTabsActivity == null ? null : currentCustomTabsActivity.get(); if (currentActivity == activity) { currentCustomTabsActivity.clear(); } try { activity.unbindService(customTabsServiceConnection); } catch (Exception ignore) { } customTabsClient = null; customTabsSession = null; }
Example 4
Source Project: Focus File: CustomTabActivityHelper.java License: GNU General Public License v3.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * @param activity the activity that is connected to the service. */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; }
Example 5
Source Project: android-browser-helper File: CustomTabActivityHelper.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * @param activity the activity that is connected to the service. */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; }
Example 6
Source Project: Focus File: CustomTabActivityHelper.java License: GNU General Public License v3.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * @param activity the activity that is connected to the service. */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; }
Example 7
Source Project: materialup File: CustomTabActivityHelper.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service * * @param activity the activity that is bound to the service */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; }
Example 8
Source Project: LLApp File: SensonListener.java License: Apache License 2.0 | 5 votes |
public void stopService(Activity activity){ //暂停服务 Intent intent = new Intent(activity, AidlService.class); activity.stopService(intent); //断开与远程Service的连接 activity.unbindService(sc); }
Example 9
Source Project: AndroidProjects File: CustomTabActivityHelper.java License: MIT License | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * * @param activity the activity that is connected to the service. */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; }
Example 10
Source Project: MaterialHome File: CustomTabActivityHelper.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service * * @param activity the activity that is bound to the service */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; }
Example 11
Source Project: android-proguards File: CustomTabActivityHelper.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service * @param activity the activity that is bound to the service */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; }
Example 12
Source Project: island File: AppListFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onDestroyView() { if (mIslandManagerConnection != null) { final Activity activity = getActivity(); if (activity != null) activity.unbindService(mIslandManagerConnection); mIslandManagerConnection = null; } super.onDestroyView(); }
Example 13
Source Project: droidddle File: CustomTabActivityHelper.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service * * @param activity the activity that is connected to the service */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; }
Example 14
Source Project: materialistic File: CustomTabsDelegate.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * * @param activity the activity that is connected to the service. */ void unbindCustomTabsService(Activity activity) { if (mConnection == null) { return; } activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; }
Example 15
Source Project: custom-tabs-client File: CustomTabActivityHelper.java License: Apache License 2.0 | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * @param activity the activity that is connected to the service. */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; }
Example 16
Source Project: cordova-plugin-background-mode File: BackgroundMode.java License: Apache License 2.0 | 5 votes |
/** * Bind the activity to a background service and put them into foreground * state. */ private void stopService() { Activity context = cordova.getActivity(); Intent intent = new Intent(context, ForegroundService.class); if (!isBind) return; fireEvent(Event.DEACTIVATE, null); context.unbindService(connection); context.stopService(intent); isBind = false; }
Example 17
Source Project: rides-android-sdk File: CustomTabsHelper.java License: MIT License | 5 votes |
/** * Called to clean up the CustomTab when the parentActivity is destroyed. */ public void onDestroy(Activity parentActivity) { if (connection != null) { parentActivity.unbindService(connection); connection = null; } }
Example 18
Source Project: Hews File: ChromeCustomTabsHelper.java License: MIT License | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service * * @param activity the activity that is connected to the service */ public void unbindCustomTabsService(Activity activity) { if (mConnection == null) return; activity.unbindService(mConnection); mCustomTabsClient = null; mCustomTabsSession = null; }
Example 19
Source Project: cordova-plugin-safariviewcontroller File: CustomTabServiceHelper.java License: MIT License | 5 votes |
/** * Unbinds the Activity from the Custom Tabs Service. * @param activity the activity that is connected to the service. */ public boolean unbindCustomTabsService(Activity activity) { if (mConnection == null) return false; activity.unbindService(mConnection); mClient = null; mCustomTabsSession = null; mConnection = null; return true; }
Example 20
Source Project: Android-nRF-Beacon File: UpdateFragment.java License: BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void onReceive(final Context context, final Intent intent) { final Activity activity = getActivity(); if (activity == null || !isResumed()) return; final String action = intent.getAction(); if (UpdateService.ACTION_STATE_CHANGED.equals(action)) { final int state = intent.getIntExtra(UpdateService.EXTRA_DATA, UpdateService.STATE_DISCONNECTED); switch (state) { case UpdateService.STATE_DISCONNECTED: mConnectButton.setText(R.string.action_connect); mConnectButton.setEnabled(true); setUuidControlsEnabled(false); setMajorMinorControlsEnabled(false); setRssiControlsEnabled(false); setManufacturerIdControlsEnabled(false); setAdvIntervalControlsEnabled(false); setLedControlsEnabled(false); mAdvancedTitleView.setEnabled(true); final Intent service = new Intent(activity, UpdateService.class); activity.unbindService(mServiceConnection); activity.stopService(service); mBinder = null; mBinded = false; break; case UpdateService.STATE_CONNECTED: mConnectButton.setText(R.string.action_disconnect); mConnectButton.setEnabled(true); break; case UpdateService.STATE_DISCONNECTING: case UpdateService.STATE_CONNECTING: mConnectButton.setEnabled(false); break; } } else if (UpdateService.ACTION_UUID_READY.equals(action)) { final UUID uuid = ((ParcelUuid) intent.getParcelableExtra(UpdateService.EXTRA_DATA)).getUuid(); mUuidView.setText(uuid.toString()); setUuidControlsEnabled(true); } else if (UpdateService.ACTION_MAJOR_MINOR_READY.equals(action)) { final int major = intent.getIntExtra(UpdateService.EXTRA_MAJOR, 0); final int minor = intent.getIntExtra(UpdateService.EXTRA_MINOR, 0); mMajorView.setText(String.valueOf(major)); mMinorView.setText(String.valueOf(minor)); setMajorMinorControlsEnabled(true); } else if (UpdateService.ACTION_RSSI_READY.equals(action)) { final int rssi = intent.getIntExtra(UpdateService.EXTRA_DATA, 0); mCalibratedRssiView.setTag(rssi); mCalibratedRssiView.setText(String.valueOf(rssi)); setRssiControlsEnabled(true); } else if (UpdateService.ACTION_MANUFACTURER_ID_READY.equals(action)) { final int manufacturerId = intent.getIntExtra(UpdateService.EXTRA_DATA, 0); mManufacturerIdView.setText(String.valueOf(manufacturerId)); setManufacturerIdControlsEnabled(true); } else if (UpdateService.ACTION_ADV_INTERVAL_READY.equals(action)) { final int interval = intent.getIntExtra(UpdateService.EXTRA_DATA, 0); mAdvIntervalView.setText(String.valueOf(interval)); setAdvIntervalControlsEnabled(true); } else if (UpdateService.ACTION_LED_STATUS_READY.equals(action)) { final boolean on = intent.getBooleanExtra(UpdateService.EXTRA_DATA, false); mLedSwitchActionDisabled = true; mLedsSwitch.setChecked(on); mLedSwitchActionDisabled = false; setLedControlsEnabled(true); } else if (UpdateService.ACTION_DONE.equals(action)) { final boolean advanced = intent.getBooleanExtra(UpdateService.EXTRA_DATA, false); mAdvancedTitleView.setEnabled(advanced); mBinder.read(); } else if (UpdateService.ACTION_GATT_ERROR.equals(action)) { final int error = intent.getIntExtra(UpdateService.EXTRA_DATA, 0); switch (error) { case UpdateService.ERROR_UNSUPPORTED_DEVICE: Toast.makeText(activity, R.string.update_error_device_not_supported, Toast.LENGTH_SHORT).show(); break; default: Toast.makeText(activity, getString(R.string.update_error_other, error), Toast.LENGTH_SHORT).show(); break; } mBinder.disconnectAndClose(); } }