List of usage examples for android.content.pm PackageManager COMPONENT_ENABLED_STATE_ENABLED
int COMPONENT_ENABLED_STATE_ENABLED
To view the source code for android.content.pm PackageManager COMPONENT_ENABLED_STATE_ENABLED.
Click Source Link
From source file:de.NeonSoft.neopowermenu.Preferences.PreferencesPartFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO: Implement this method MainActivity.visibleFragment = "Main"; mContext = getActivity();/*www . ja v a2 s. com*/ ActiveStyle = MainActivity.preferences.getString("DialogTheme", "Material"); hideicon = MainActivity.preferences.getBoolean("HideLauncherIcon", false); DeepXposedLogging = MainActivity.preferences.getBoolean("DeepXposedLogging", false); InflatedView = inflater.inflate(R.layout.activity_preferences, container, false); TextView_ModuleStateTitle = (TextView) InflatedView .findViewById(R.id.activitypreferencesTextView_ModuleStateTitle); TextView_ModuleStateDesc = (TextView) InflatedView .findViewById(R.id.activitypreferencesTextView_ModuleStateDesc); LinearLayout_Style = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Style); TextView_StyleTitle = (TextView) InflatedView.findViewById(R.id.activitypreferencesTextView_StyleTitle); TextView_StyleDesc = (TextView) InflatedView.findViewById(R.id.activitypreferencesTextView_StyleDesc); TextView_StyleDesc.setText(getString(R.string.preferencesDesc_Style).replace("[STYLENAME]", ActiveStyle)); LinearLayout_Theme = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Theme); LinearLayout_VisibilityOrder = (LinearLayout) InflatedView .findViewById(R.id.activitypreferencesLinearLayout_VisibilityOrder); LinearLayout_Advanced = (LinearLayout) InflatedView .findViewById(R.id.activitypreferencesLinearLayout_Advanced); LinearLayout_HideLauncherIcon = (LinearLayout) InflatedView .findViewById(R.id.activitypreferencesLinearLayout_HideLauncherIcon); Switch_HideLauncherIcon = (Switch) InflatedView .findViewById(R.id.activitypreferencesSwitch_HideLauncherIcon); Switch_HideLauncherIcon.setChecked(hideicon); Switch_HideLauncherIcon.setClickable(false); Switch_HideLauncherIcon.setFocusable(false); LinearLayout_DeepXposedLogging = (LinearLayout) InflatedView .findViewById(R.id.activitypreferencesLinearLayout_DeepXposedLogging); Switch_DeepXposedLogging = (Switch) InflatedView .findViewById(R.id.activitypreferencesSwitch_DeepXposedLogging); Switch_DeepXposedLogging.setChecked(DeepXposedLogging); Switch_DeepXposedLogging.setClickable(false); Switch_DeepXposedLogging.setFocusable(false); LinearLayout_Source = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Source); LinearLayout_OrigSource = (LinearLayout) InflatedView .findViewById(R.id.activitypreferencesLinearLayout_OrigSource); LinearLayout_Share = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_Share); LinearLayout_Translator = (LinearLayout) InflatedView .findViewById(R.id.activitypreferencesLinearLayout_Translator); LinearLayout_About = (LinearLayout) InflatedView.findViewById(R.id.activitypreferencesLinearLayout_About); LinearLayout_Style.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { // TODO: Implement this method AlertDialog.Builder alertdb = new AlertDialog.Builder(getActivity()); alertdb.setTitle(R.string.preferencesTitle_Style); String[] styleList = new String[1]; styleList[0] = "Material"; for (int i = 0; i < styleList.length; i++) { if (styleList[i].equalsIgnoreCase(ActiveStyle)) { ActiveStyleId = i; //presetsList[i] = "(Active) "+ presetsFiles[i].getName().split(".nps")[0]; } } alertdb.setSingleChoiceItems(styleList, ActiveStyleId, null); alertdb.setNegativeButton(R.string.Dialog_Cancel, new AlertDialog.OnClickListener() { @Override public void onClick(DialogInterface p1, int p2) { // TODO: Implement this method } }); alertdb.setPositiveButton(R.string.Dialog_Ok, new AlertDialog.OnClickListener() { @Override public void onClick(DialogInterface p1, int p2) { // TODO: Implement this method try { int selectedPosition = (ad).getListView().getCheckedItemPosition(); String selectedName = (ad).getListView().getItemAtPosition(selectedPosition).toString(); MainActivity.preferences.edit().putString("DialogTheme", selectedName).commit(); ActiveStyle = selectedName; TextView_StyleDesc.setText( getString(R.string.preferencesDesc_Style).replace("[STYLENAME]", ActiveStyle)); } catch (Throwable t) { } } }); ad = alertdb.create(); ad.show(); } }); LinearLayout_Theme.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { MainActivity.fragmentManager.beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.pref_container, new PreferencesColorFragment()).commit(); } }); LinearLayout_VisibilityOrder.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { MainActivity.fragmentManager.beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.pref_container, new PreferencesVisibilityOrderFragment()).commit(); } }); LinearLayout_Advanced.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { MainActivity.fragmentManager.beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.pref_container, new PreferencesAdvancedFragment()).commit(); } }); LinearLayout_HideLauncherIcon.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { hideicon = !hideicon; String packageName = getActivity().getPackageName(); ComponentName componentSettings = new ComponentName(packageName, packageName + ".SettingsActivity"); if (hideicon) { getActivity().getPackageManager().setComponentEnabledSetting(componentSettings, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); } else { getActivity().getPackageManager().setComponentEnabledSetting(componentSettings, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } Switch_HideLauncherIcon.setChecked(hideicon); MainActivity.preferences.edit().putBoolean("HideLauncherIcon", hideicon).commit(); } }); LinearLayout_DeepXposedLogging.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { DeepXposedLogging = !DeepXposedLogging; Switch_DeepXposedLogging.setChecked(DeepXposedLogging); MainActivity.preferences.edit().putBoolean("DeepXposedLogging", DeepXposedLogging).commit(); } }); LinearLayout_Source.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { // TODO: Implement this method Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(Urlgithub)); startActivity(i); } }); LinearLayout_OrigSource.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { // TODO: Implement this method Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(Urloriggithub)); startActivity(i); } }); LinearLayout_Share.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { // TODO: Implement this method Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.app_name)); String sAux = getString(R.string.ShareMessage); sAux = sAux + "repo.xposed.info/module/de.NeonSoft.neopowermenu \n\n"; i.putExtra(Intent.EXTRA_TEXT, sAux); startActivity(Intent.createChooser(i, getString(R.string.preferencesTitle_Share))); } }); LinearLayout_About.setOnClickListener(new OnClickListener() { @Override public void onClick(View p1) { // TODO: Implement this method adb = new AlertDialog.Builder(getActivity()); adb.setTitle("About"); adb.setMessage("NeoPowerMenu by Neon-Soft / DrAcHe981\n" + "based on a Source from Naman Dwivedi (naman14)\n\n" + "< Used Librarys >\n" + "> HoloColorPicker from Lars Werkman\n" + "An Android Holo themed colorpicker designed by Marie Schweiz\n\n" + "Licensed under the Apache License, Version 2.0\n\n" + "> DragSortListView from Bauerca\n" + "DragSortListView (DSLV) is an extension of the Android ListView that enables drag-and-drop reordering of list items.\n\n" + "Licensed under the Apache License, Version 2.0\n\n" + "> libsuperuser from Chainfire / ChainsDD\n\n" + "Licensed under the Apache License, Version 2.0\n\n" + ""); adb.setPositiveButton(R.string.Dialog_Ok, null); ad = adb.create(); ad.show(); } }); checkState(); if (!MainActivity.RootAvailable) { pd = new ProgressDialog(getActivity()); pd.setMessage(getString(R.string.Dialog_WaitForRoot)); pd.setIndeterminate(true); pd.setCancelable(false); pd.setCanceledOnTouchOutside(false); pd.setButton(pd.BUTTON_NEGATIVE, getString(R.string.Dialog_Cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface p1, int p2) { pd.dismiss(); getActivity().finish(); } }); pd.setButton(pd.BUTTON_NEUTRAL, getString(R.string.Dialog_Ignore), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface p1, int p2) { pd.dismiss(); } }); pd.show(); } else if (MainActivity.RootAvailable) { rootAvailable(); } getPermissions(); return InflatedView; }
From source file:de.Maxr1998.xposed.maxlock.ui.settings.SettingsFragment.java
@Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { super.onPreferenceTreeClick(preferenceScreen, preference); if (preference == findPreference(Common.LOCKING_TYPE_SETTINGS)) { launchFragment(new LockingTypeSettingsFragment(), true, this); return true; } else if (preference == findPreference(Common.LOCKING_UI_SETTINGS)) { launchFragment(new LockingUISettingsFragment(), true, this); return true; } else if (preference == findPreference(Common.LOCKING_OPTIONS)) { PREFS.edit().putBoolean(Common.ENABLE_LOGGING, PREFS.getBoolean(Common.ENABLE_PRO, false)).apply(); launchFragment(new LockingOptionsFragment(), true, this); return true; } else if (preference == findPreference(Common.IIMOD_OPTIONS)) { // Setup remain timer long timer = PREFS.getInt(Common.IMOD_DELAY_GLOBAL, 600000) - (System.currentTimeMillis() - PREFS.getLong(Common.IMOD_LAST_UNLOCK_GLOBAL, 0)); if (timer < 0) { timer = 0L;//from ww w. j a va2 s . c o m } PREFS.edit().putInt(Common.IMOD_REMAIN_TIMER_GLOBAL, (int) timer).apply(); launchFragment(new LockingIntikaFragment(), true, this); return true; } else if (preference == findPreference(Common.CHOOSE_APPS)) { launchFragment(new AppListFragment(), true, this); return true; } else if (preference == findPreference(Common.HIDE_APP_FROM_LAUNCHER) && preference instanceof CheckBoxPreference) { CheckBoxPreference hideApp = (CheckBoxPreference) preference; if (hideApp.isChecked()) { Toast.makeText(getActivity(), R.string.reboot_required, Toast.LENGTH_SHORT).show(); ComponentName componentName = new ComponentName(getActivity(), "de.Maxr1998.xposed.maxlock.Main"); getActivity().getPackageManager().setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } else { ComponentName componentName = new ComponentName(getActivity(), "de.Maxr1998.xposed.maxlock.Main"); getActivity().getPackageManager().setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); } } else if (preference == findPreference(Common.USE_DARK_STYLE) || preference == findPreference(Common.ENABLE_PRO)) { ((SettingsActivity) getActivity()).restart(); return true; } else if (preference == findPreference(Common.UNINSTALL)) { if (!isDeviceAdminActive()) { Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, deviceAdmin); startActivity(intent); } else { devicePolicyManager.removeActiveAdmin(deviceAdmin); } return true; } return false; }
From source file:com.android.transmart.PlaceActivity.java
@Override protected void onPause() { // Commit shared preference that says we're in the background. prefsEditor.putBoolean(LocationConstants.EXTRA_KEY_IN_BACKGROUND, true); sharedPreferenceSaver.savePreferences(prefsEditor, false); // Enable the Manifest Checkin Receiver when the Activity isn't active. // The Manifest Checkin Receiver is designed to run only when the Application // isn't active to notify the user of pending checkins that have succeeded // (usually through a Notification). packageManager.setComponentEnabledSetting(newCheckinReceiverName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); // Unregister the checkinReceiver when the Activity is inactive. unregisterReceiver(checkinReceiver); // Stop listening for location updates when the Activity is inactive. disableLocationUpdates();//from w w w. j a v a 2 s. c om super.onPause(); }
From source file:org.solovyev.android.calculator.App.java
public static void enableComponent(@Nonnull Context context, @Nonnull Class<?> componentClass, boolean enable) { final PackageManager pm = context.getPackageManager(); final int componentState; if (enable) { componentState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED; } else {/*from w ww. j a v a2s . c om*/ componentState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED; } pm.setComponentEnabledSetting(new ComponentName(context, componentClass), componentState, PackageManager.DONT_KILL_APP); }
From source file:tjs.tuneramblr.TuneramblrMobileActivity.java
@Override protected void onPause() { // Commit shared preference that says we're in the background. prefsEditor.putBoolean(TuneramblrConstants.EXTRA_KEY_IN_BACKGROUND, true); sharedPreferenceSaver.savePreferences(prefsEditor, false); /*/*from w w w .j a va2 s . c o m*/ * Enable the Manifest Checkin Receiver when the Activity isn't active. * The Manifest Checkin Receiver is designed to run only when the * Application isn't active to notify the user of pending checkins that * have succeeded (usually through a Notification). */ packageManager.setComponentEnabledSetting(newCheckinReceiverName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); // Unregister the checkinReceiver when the Activity is inactive. unregisterReceiver(checkinReceiver); unregisterReceiver(loginReceiver); // Stop listening for location updates when the Activity is inactive. disableLocationUpdates(); super.onPause(); }
From source file:org.site_monitor.activity.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_refresh) { if (BuildConfig.DEBUG) { Log.i(TAG, "global refresh requested"); }// w ww . j av a2 s . c o m NetworkService.enqueueCheckSitesWork(this); return true; } if (id == R.id.action_settings) { PrefSettingsActivity.start(context); return true; } if (id == R.id.action_about) { AboutActivity.start(context); return true; } if (id == R.id.action_inject) { try { DummySiteInjector.inject(this.getCurrentFocus(), taskFragment, dbHelper.getDBSiteSettings()); loadSiteSettingsBusinesses(); alarmUtil.startAlarmIfNeeded(context); } catch (SQLException e) { Log.e(TAG, "dummyinject", e); } return true; } if (id == R.id.action_debug) { StringBuilder sb = new StringBuilder("you're on alpha version").append("\n"); sb.append("Connectivity: ").append(ConnectivityUtil.isConnected(context)).append("\n"); int startupBootState = context.getPackageManager() .getComponentEnabledSetting(new ComponentName(context, StartupBootReceiver.class)); boolean startupBootEnable = (startupBootState == PackageManager.COMPONENT_ENABLED_STATE_DEFAULT || startupBootState == PackageManager.COMPONENT_ENABLED_STATE_ENABLED); sb.append("StartupBoot state: ").append(startupBootEnable).append("\n"); sb.append("Alarm set: ").append(alarmUtil.getCurrentInterval()).append("\n"); sb.append("Battery: ").append(BatteryLevelReceiver.getLastAction()).append("\n"); Toast.makeText(this, sb.toString(), Toast.LENGTH_LONG).show(); return true; } return super.onOptionsItemSelected(item); }
From source file:org.mariotaku.twidere.app.TwidereApplication.java
@Override public void onCreate() { sInstance = this; if (BuildConfig.DEBUG) { StrictModeUtils.detectAllVmPolicy(); }// www . j av a2 s.c om final SharedPreferences preferences = getSharedPreferences(); resetTheme(preferences); super.onCreate(); mProfileImageViewViewProcessor = new ProfileImageViewViewProcessor(); mFontFamilyTagProcessor = new FontFamilyTagProcessor(); ATE.registerViewProcessor(TabPagerIndicator.class, new TabPagerIndicatorViewProcessor()); ATE.registerViewProcessor(FloatingActionButton.class, new FloatingActionButtonViewProcessor()); ATE.registerViewProcessor(ActionBarContextView.class, new ActionBarContextViewViewProcessor()); ATE.registerViewProcessor(SwipeRefreshLayout.class, new SwipeRefreshLayoutViewProcessor()); ATE.registerViewProcessor(TimelineContentTextView.class, new TimelineContentTextViewViewProcessor()); ATE.registerViewProcessor(TextView.class, new TextViewViewProcessor()); ATE.registerViewProcessor(ImageView.class, new ImageViewViewProcessor()); ATE.registerViewProcessor(MaterialEditText.class, new MaterialEditTextViewProcessor()); ATE.registerViewProcessor(ProgressWheel.class, new ProgressWheelViewProcessor()); ATE.registerViewProcessor(ProfileImageView.class, mProfileImageViewViewProcessor); ATE.registerTagProcessor(OptimalLinkColorTagProcessor.TAG, new OptimalLinkColorTagProcessor()); ATE.registerTagProcessor(FontFamilyTagProcessor.TAG, mFontFamilyTagProcessor); ATE.registerTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR, new IconActionButtonTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR)); ATE.registerTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_ACTIVATED, new IconActionButtonTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_ACTIVATED)); ATE.registerTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_DISABLED, new IconActionButtonTagProcessor(IconActionButtonTagProcessor.PREFIX_COLOR_DISABLED)); ATE.registerTagProcessor(ThemedMultiValueSwitch.PREFIX_TINT, new ThemedMultiValueSwitch.TintTagProcessor()); mProfileImageViewViewProcessor.setStyle(Utils.getProfileImageStyle(preferences)); mFontFamilyTagProcessor.setFontFamily(ThemeUtils.getThemeFontFamily(preferences)); final int themeColor = preferences.getInt(KEY_THEME_COLOR, ContextCompat.getColor(this, R.color.branding_color)); if (!ATE.config(this, VALUE_THEME_NAME_LIGHT).isConfigured()) { //noinspection WrongConstant ATE.config(this, VALUE_THEME_NAME_LIGHT).primaryColor(themeColor) .accentColor(ThemeUtils.getOptimalAccentColor(themeColor, Color.BLACK)).coloredActionBar(true) .coloredStatusBar(true).commit(); } if (!ATE.config(this, VALUE_THEME_NAME_DARK).isConfigured()) { ATE.config(this, VALUE_THEME_NAME_DARK) .accentColor(ThemeUtils.getOptimalAccentColor(themeColor, Color.WHITE)).coloredActionBar(false) .coloredStatusBar(true).statusBarColor(Color.BLACK).commit(); } if (!ATE.config(this, null).isConfigured()) { ATE.config(this, null).accentColor(ThemeUtils.getOptimalAccentColor(themeColor, Color.WHITE)) .coloredActionBar(false).coloredStatusBar(false).commit(); } initializeAsyncTask(); initDebugMode(); initBugReport(); mHandler = new Handler(); final PackageManager pm = getPackageManager(); final ComponentName main = new ComponentName(this, MainActivity.class); final ComponentName main2 = new ComponentName(this, MainHondaJOJOActivity.class); final boolean mainDisabled = pm .getComponentEnabledSetting(main) != PackageManager.COMPONENT_ENABLED_STATE_ENABLED; final boolean main2Disabled = pm .getComponentEnabledSetting(main2) != PackageManager.COMPONENT_ENABLED_STATE_ENABLED; final boolean noEntry = mainDisabled && main2Disabled; if (noEntry) { pm.setComponentEnabledSetting(main, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); } else if (!mainDisabled) { pm.setComponentEnabledSetting(main2, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } if (!Utils.isComposeNowSupported(this)) { final ComponentName assist = new ComponentName(this, AssistLauncherActivity.class); pm.setComponentEnabledSetting(assist, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); } migrateUsageStatisticsPreferences(); Utils.startRefreshServiceIfNeeded(this); DependencyHolder holder = DependencyHolder.get(this); registerActivityLifecycleCallbacks(holder.getActivityTracker()); final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addAction(Intent.ACTION_PACKAGE_REPLACED); registerReceiver(new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final int uid = intent.getIntExtra(Intent.EXTRA_UID, -1); final String[] packages = getPackageManager().getPackagesForUid(uid); DependencyHolder holder = DependencyHolder.get(context); final ExternalThemeManager manager = holder.getExternalThemeManager(); if (ArrayUtils.contains(packages, manager.getEmojiPackageName())) { manager.reloadEmojiPreferences(); } } }, packageFilter); }
From source file:org.addhen.smssync.util.Util.java
/** * Makes an attempt to connect to a data network. *//*from www. j av a2 s .c o m*/ public static void connectToDataNetwork(Context context) { // Enable the Connectivity Changed Receiver to listen for // connection to a network so we can send pending messages. PackageManager pm = context.getPackageManager(); ComponentName connectivityReceiver = new ComponentName(context, ConnectivityChangedReceiver.class); pm.setComponentEnabledSetting(connectivityReceiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); }
From source file:com.radioactiveyak.location_best_practices.UI.PlaceActivity.java
@Override protected void onPause() { // Commit shared preference that says we're in the background. prefsEditor.putBoolean(PlacesConstants.EXTRA_KEY_IN_BACKGROUND, true); sharedPreferenceSaver.savePreferences(prefsEditor, false); // Enable the Manifest Checkin Receiver when the Activity isn't active. // The Manifest Checkin Receiver is designed to run only when the Application // isn't active to notify the user of pending checkins that have succeeded // (usually through a Notification). packageManager.setComponentEnabledSetting(newCheckinReceiverName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); // Unregister the checkinReceiver when the Activity is inactive. unregisterReceiver(checkinReceiver); // Stop listening for location updates when the Activity is inactive. disableLocationUpdates();//w ww . j a va 2 s . co m super.onPause(); }
From source file:com.google.android.gms.location.sample.geofencing.GeofenceTransitionsIntentService.java
private void activateScanReceiver() { System.out.println("? ? ?"); ComponentName receiver = new ComponentName(this, WiFiScanReceiver.class); PackageManager pm = this.getPackageManager(); pm.setComponentEnabledSetting(receiver, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); }