List of usage examples for android.content Intent ACTION_PACKAGE_CHANGED
String ACTION_PACKAGE_CHANGED
To view the source code for android.content Intent ACTION_PACKAGE_CHANGED.
Click Source Link
From source file:com.android.contacts.model.AccountTypeManager.java
/** * Internal constructor that only performs initial parsing. */// w w w . j a va 2s.co m public AccountTypeManagerImpl(Context context) { mContext = context; mLocalAccountLocator = DeviceLocalAccountLocator.create(context); mTypeProvider = new AccountTypeProvider(context); mFallbackAccountType = new FallbackAccountType(context); mAccountManager = AccountManager.get(mContext); mExecutor = ContactsExecutors.getDefaultThreadPoolExecutor(); mMainThreadExecutor = ContactsExecutors.newHandlerExecutor(mMainThreadHandler); // Request updates when packages or accounts change IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mContext.registerReceiver(mBroadcastReceiver, filter); IntentFilter sdFilter = new IntentFilter(); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); mContext.registerReceiver(mBroadcastReceiver, sdFilter); // Request updates when locale is changed so that the order of each field will // be able to be changed on the locale change. filter = new IntentFilter(Intent.ACTION_LOCALE_CHANGED); mContext.registerReceiver(mBroadcastReceiver, filter); mAccountManager.addOnAccountsUpdatedListener(this, mMainThreadHandler, false); ContentResolver.addStatusChangeListener(ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, this); if (Flags.getInstance().getBoolean(Experiments.CP2_DEVICE_ACCOUNT_DETECTION_ENABLED)) { // Observe changes to RAW_CONTACTS so that we will update the list of "Device" accounts // if a new device contact is added. mContext.getContentResolver().registerContentObserver(ContactsContract.RawContacts.CONTENT_URI, /* notifyDescendents */ true, new ContentObserver(mMainThreadHandler) { @Override public boolean deliverSelfNotifications() { return true; } @Override public void onChange(boolean selfChange) { reloadLocalAccounts(); } @Override public void onChange(boolean selfChange, Uri uri) { reloadLocalAccounts(); } }); } loadAccountTypes(); }
From source file:com.cognizant.trumobi.PersonaLauncher.java
private void registerIntentReceivers() { boolean useNotifReceiver = PersonaAlmostNexusSettingsHelper.getNotifReceiver(this); if (useNotifReceiver && mCounterReceiver == null) { mCounterReceiver = new PersonaCounterReceiver(this); mCounterReceiver.setCounterListener(new PersonaCounterReceiver.OnCounterChangedListener() { public void onTrigger(String pname, int counter, int color) { PersonaLog.d("personalauncher", "updateCountersForPackage called from registerIntentReceivers"); //updateCountersForPackage(pname, counter, color, 0); Bundle b = new Bundle(); b.putString("package", "com.cognizant.trumobi"); b.putInt("counter", counter); b.putInt("color", R.color.PR_TEXTBOX_FOCUSED_COLOR); b.putInt("updateCountFor", 0); Message m = new Message(); m.setData(b);//w w w . j a v a 2 s . c o m UiHandler.sendMessage(m); } }); registerReceiver(mCounterReceiver, mCounterReceiver.getFilter()); } IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED); filter.addAction(Intent.ACTION_PACKAGE_REMOVED); filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); registerReceiver(mApplicationsReceiver, filter); filter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mCloseSystemDialogsReceiver, filter); filter = new IntentFilter(); filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE); filter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE); registerReceiver(mApplicationsReceiver, filter); }