List of usage examples for android.content.pm PackageManager GET_RECEIVERS
int GET_RECEIVERS
To view the source code for android.content.pm PackageManager GET_RECEIVERS.
Click Source Link
From source file:com.github.michalbednarski.intentslab.browser.ComponentFetcher.java
@Override void onPrepareOptionsMenu(Menu menu) { if (appType == APP_TYPE_USER) { menu.findItem(R.id.system_apps).setVisible(true); } else if (appType == APP_TYPE_SYSTEM) { menu.findItem(R.id.user_apps).setVisible(true); }//from www. jav a 2s.co m if (type == PackageManager.GET_ACTIVITIES) { menu.findItem(R.id.activities).setChecked(true); } else if (type == PackageManager.GET_RECEIVERS) { menu.findItem(R.id.broadcasts).setChecked(true); } else if (type == PackageManager.GET_SERVICES) { menu.findItem(R.id.services).setChecked(true); } else if (type == PackageManager.GET_PROVIDERS) { menu.findItem(R.id.content_providers).setChecked(true); } menu.findItem(R.id.simple_filter_permission).setVisible(true); for (int i = 0; i < PROTECTION_PRESETS_MENU_IDS.length; i++) { if (protection == PROTECTION_PRESETS[i]) { menu.findItem(PROTECTION_PRESETS_MENU_IDS[i]).setChecked(true); } } }
From source file:com.apptentive.android.sdk.ApptentiveInternal.java
public boolean init() { boolean bRet = true; codePointStore.init();/*from w w w . j a v a 2 s. co m*/ /* If Message Center feature has never been used before, don't initialize message polling thread. * Message Center feature will be seen as used, if one of the following conditions has been met: * 1. Message Center has been opened for the first time * 2. The first Push is received which would open Message Center * 3. An unreadMessageCountListener() is set up */ boolean featureEverUsed = prefs.getBoolean(Constants.PREF_KEY_MESSAGE_CENTER_FEATURE_USED, false); if (featureEverUsed) { messageManager.init(); } conversationToken = prefs.getString(Constants.PREF_KEY_CONVERSATION_TOKEN, null); conversationId = prefs.getString(Constants.PREF_KEY_CONVERSATION_ID, null); personId = prefs.getString(Constants.PREF_KEY_PERSON_ID, null); apptentiveToolbarTheme = appContext.getResources().newTheme(); boolean apptentiveDebug = false; String logLevelOverride = null; String manifestApiKey = null; try { appPackageName = appContext.getPackageName(); PackageManager packageManager = appContext.getPackageManager(); PackageInfo packageInfo = packageManager.getPackageInfo(appPackageName, PackageManager.GET_META_DATA | PackageManager.GET_RECEIVERS); ApplicationInfo ai = packageInfo.applicationInfo; Bundle metaData = ai.metaData; if (metaData != null) { manifestApiKey = Util.trim(metaData.getString(Constants.MANIFEST_KEY_APPTENTIVE_API_KEY)); logLevelOverride = Util.trim(metaData.getString(Constants.MANIFEST_KEY_APPTENTIVE_LOG_LEVEL)); apptentiveDebug = metaData.getBoolean(Constants.MANIFEST_KEY_APPTENTIVE_DEBUG); } // Used for application theme inheritance if the theme is an AppCompat theme. setApplicationDefaultTheme(ai.theme); AppRelease appRelease = AppRelease.generateCurrentAppRelease(appContext); isAppDebuggable = appRelease.getDebug(); currentVersionCode = appRelease.getVersionCode(); currentVersionName = appRelease.getVersionName(); VersionHistoryEntry lastVersionEntrySeen = VersionHistoryStore.getLastVersionSeen(); if (lastVersionEntrySeen == null) { onVersionChanged(null, currentVersionCode, null, currentVersionName, appRelease); } else { int lastSeenVersionCode = lastVersionEntrySeen.getVersionCode(); Apptentive.Version lastSeenVersionNameVersion = new Apptentive.Version(); lastSeenVersionNameVersion.setVersion(lastVersionEntrySeen.getVersionName()); if (!(currentVersionCode == lastSeenVersionCode) || !currentVersionName.equals(lastSeenVersionNameVersion.getVersion())) { onVersionChanged(lastVersionEntrySeen.getVersionCode(), currentVersionCode, lastVersionEntrySeen.getVersionName(), currentVersionName, appRelease); } } defaultAppDisplayName = packageManager .getApplicationLabel(packageManager.getApplicationInfo(packageInfo.packageName, 0)).toString(); // Prevent delayed run-time exception if the app upgrades from pre-2.0 and doesn't remove NetworkStateReceiver from manifest ActivityInfo[] registered = packageInfo.receivers; if (registered != null) { for (ActivityInfo activityInfo : registered) { // Throw assertion error when relict class found in manifest. if (activityInfo.name.equals("com.apptentive.android.sdk.comm.NetworkStateReceiver")) { throw new AssertionError( "NetworkStateReceiver has been removed from Apptentive SDK, please make sure it's also removed from manifest file"); } } } } catch (Exception e) { ApptentiveLog.e("Unexpected error while reading application or package info.", e); bRet = false; } // Set debuggable and appropriate log level. if (apptentiveDebug) { ApptentiveLog.i("Apptentive debug logging set to VERBOSE."); setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); } else if (logLevelOverride != null) { ApptentiveLog.i("Overriding log level: %s", logLevelOverride); setMinimumLogLevel(ApptentiveLog.Level.parse(logLevelOverride)); } else { if (isAppDebuggable) { setMinimumLogLevel(ApptentiveLog.Level.VERBOSE); } } ApptentiveLog.i("Debug mode enabled? %b", isAppDebuggable); String lastSeenSdkVersion = prefs.getString(Constants.PREF_KEY_LAST_SEEN_SDK_VERSION, ""); if (!lastSeenSdkVersion.equals(Constants.APPTENTIVE_SDK_VERSION)) { onSdkVersionChanged(appContext, lastSeenSdkVersion, Constants.APPTENTIVE_SDK_VERSION); } // The apiKey can be passed in programmatically, or we can fallback to checking in the manifest. if (TextUtils.isEmpty(apiKey) && !TextUtils.isEmpty(manifestApiKey)) { apiKey = manifestApiKey; } if (TextUtils.isEmpty(apiKey) || apiKey.contains(Constants.EXAMPLE_API_KEY_VALUE)) { String errorMessage = "The Apptentive API Key is not defined. You may provide your Apptentive API Key in Apptentive.register(), or in as meta-data in your AndroidManifest.xml.\n" + "<meta-data android:name=\"apptentive_api_key\"\n" + " android:value=\"@string/your_apptentive_api_key\"/>"; if (isAppDebuggable) { throw new RuntimeException(errorMessage); } else { ApptentiveLog.e(errorMessage); } } else { ApptentiveLog.d("Using cached Apptentive API Key"); } ApptentiveLog.d("Apptentive API Key: %s", apiKey); // Grab app info we need to access later on. androidId = Settings.Secure.getString(appContext.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); ApptentiveLog.d("Android ID: ", androidId); ApptentiveLog.d("Default Locale: %s", Locale.getDefault().toString()); ApptentiveLog.d("Conversation id: %s", prefs.getString(Constants.PREF_KEY_CONVERSATION_ID, "null")); return bRet; }
From source file:com.github.michalbednarski.intentslab.browser.ComponentFetcher.java
@Override boolean onOptionsItemSelected(int id) { switch (id) { case R.id.system_apps: appType = APP_TYPE_SYSTEM;// ww w . j a va 2s .c o m return true; case R.id.user_apps: appType = APP_TYPE_USER; return true; case R.id.activities: type = PackageManager.GET_ACTIVITIES; return true; case R.id.broadcasts: type = PackageManager.GET_RECEIVERS; return true; case R.id.services: type = PackageManager.GET_SERVICES; return true; case R.id.content_providers: type = PackageManager.GET_PROVIDERS; return true; case R.id.permission_filter_all: protection = PROTECTION_ANY; return true; case R.id.permission_filter_exported: protection = PROTECTION_ANY_EXPORTED; return true; case R.id.permission_filter_obtainable: protection = PROTECTION_ANY_OBTAINABLE; return true; case R.id.permission_filter_world_accessible: protection = PROTECTION_WORLD_ACCESSIBLE; return true; } return false; }
From source file:com.landenlabs.all_devtool.PackageFragment.java
/** * Load installed (user or system) packages. *//*from w w w . j a va 2 s .c o m*/ void loadInstalledPackages() { try { m_workList = new ArrayList<PackingItem>(); int flags1 = PackageManager.GET_PERMISSIONS | PackageManager.GET_PROVIDERS // use hides some app, may require permissions | PackageManager.GET_ACTIVITIES | PackageManager.GET_RECEIVERS // use hides some app, may require permissions | PackageManager.GET_SERVICES; int flags2 = PackageManager.GET_PERMISSIONS | PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES; int flags3 = PackageManager.GET_PERMISSIONS; int flags4 = 0; boolean showSys = (m_show == SHOW_SYS); // Some packages will not appear with some flags. loadAndAddPackages(showSys, flags1); loadAndAddPackages(showSys, flags2); loadAndAddPackages(showSys, flags3); loadAndAddPackages(showSys, flags4); // Sort per settings. // TODO *** This does not seem to be working *** Message msgObj = m_handler.obtainMessage(MSG_SORT_LIST); m_handler.sendMessage(msgObj); } catch (Exception ex) { m_log.e(ex.getMessage()); } }