android Programming Glossary: context.getpackagemanager
camera app not working? http://stackoverflow.com/questions/10186503/camera-app-not-working private boolean checkCameraHardware Context context if context.getPackageManager .hasSystemFeature PackageManager.FEATURE_CAMERA this device..
Calling camera from an activity, capturing an image and uploading to a server http://stackoverflow.com/questions/10679571/calling-camera-from-an-activity-capturing-an-image-and-uploading-to-a-server context String action final PackageManager packageManager context.getPackageManager final Intent intent new Intent action List ResolveInfo list..
uninstall app silently with system priveleges http://stackoverflow.com/questions/10900928/uninstall-app-silently-with-system-priveleges observer new PackageInstallObserver pm context.getPackageManager Class types new Class Uri.class IPackageInstallObserver.class.. observerdelete new PackageDeleteObserver pm context.getPackageManager Class types new Class Uri.class IPackageInstallObserver.class..
How to get a list of installed android applications and pick one to run http://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run Intent.CATEGORY_LAUNCHER final List pkgAppsList context.getPackageManager .queryIntentActivities mainIntent 0 You will get all the necessary..
Open another application from your own (intent) http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent Get the PackageManager from the current context using context.getPackageManager packageManager.queryIntentActivity intent 0 where intent has..
How do I determine if Android can handle PDF http://stackoverflow.com/questions/2784847/how-do-i-determine-if-android-can-handle-pdf Context context PackageManager packageManager context.getPackageManager Intent testIntent new Intent Intent.ACTION_VIEW testIntent.setType..
How to get app install time from android http://stackoverflow.com/questions/2831333/how-to-get-app-install-time-from-android android share improve this question PackageManager pm context.getPackageManager ApplicationInfo appInfo pm.getApplicationInfo app.package.name..
Download a file with Android, and showing the progress in a ProgressDialog http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog List ResolveInfo list context.getPackageManager .queryIntentActivities intent PackageManager.MATCH_DEFAULT_ONLY..
Intent to launch the clock application on android http://stackoverflow.com/questions/3590955/intent-to-launch-the-clock-application-on-android works for my clock widget. PackageManager packageManager context.getPackageManager Intent alarmClockIntent new Intent Intent.ACTION_MAIN .addCategory..
How to get the build/version number of your android application? http://stackoverflow.com/questions/4616095/how-to-get-the-build-version-number-of-your-android-application if you just want the version name. String versionName context.getPackageManager .getPackageInfo context.getPackageName 0 .versionName share..
Open Facebook page from Android app? http://stackoverflow.com/questions/4810803/open-facebook-page-from-android-app static Intent getOpenFacebookIntent Context context try context.getPackageManager .getPackageInfo com.facebook.katana 0 return new Intent Intent.ACTION_VIEW..
Supporting Amazon and Android market links inside application http://stackoverflow.com/questions/5480235/supporting-amazon-and-android-market-links-inside-application isMarketSig false int currentSig 1 try Signature sigs context.getPackageManager .getPackageInfo context.getPackageName PackageManager.GET_SIGNATURES..
Android - how to get app signature? http://stackoverflow.com/questions/5578871/android-how-to-get-app-signature android content pm PackageManager.html Signature sigs context.getPackageManager .getPackageInfo context.getPackageName PackageManager.GET_SIGNATURES..
How turn on camera flash light programmatically in Android? http://stackoverflow.com/questions/6068803/how-turn-on-camera-flash-light-programmatically-in-android availability of flash in device You can use the following context.getPackageManager .hasSystemFeature PackageManager.FEATURE_CAMERA_FLASH which..
Android - how to unregister a receiver created in the manifest? http://stackoverflow.com/questions/6529276/android-how-to-unregister-a-receiver-created-in-the-manifest Check if the Component is enabled or disabled int status context.getPackageManager .getComponentEnabledSetting component if status PackageManager.COMPONENT_ENABLED_STATE_ENABLED.. the component Broadcast Receiver in your case Disable context.getPackageManager .setComponentEnabledSetting component PackageManager.COMPONENT_ENABLED_STATE_DISABLED.. PackageManager.DONT_KILL_APP Enable context.getPackageManager .setComponentEnabledSetting component PackageManager.COMPONENT_ENABLED_STATE_ENABLED..
How to support Amazon and Android Market links in same APK [duplicate] http://stackoverflow.com/questions/7683130/how-to-support-amazon-and-android-market-links-in-same-apk to 1 to avoid any exceptions later on. try Signature sigs context.getPackageManager .getPackageInfo context.getPackageName PackageManager.GET_SIGNATURES..
Detect if app was downloaded from Android Market http://stackoverflow.com/questions/986627/detect-if-app-was-downloaded-from-android-market read the signature of your app try PackageManager manager context.getPackageManager PackageInfo appInfo manager.getPackageInfo YOUR_PACKAGE_NAME..
camera app not working? http://stackoverflow.com/questions/10186503/camera-app-not-working return c returns null if camera is unavailable private boolean checkCameraHardware Context context if context.getPackageManager .hasSystemFeature PackageManager.FEATURE_CAMERA this device has a camera return true else no camera on this device return..
Calling camera from an activity, capturing an image and uploading to a server http://stackoverflow.com/questions/10679571/calling-camera-from-an-activity-capturing-an-image-and-uploading-to-a-server data public static boolean isIntentAvailable Context context String action final PackageManager packageManager context.getPackageManager final Intent intent new Intent action List ResolveInfo list packageManager.queryIntentActivities intent PackageManager.MATCH_DEFAULT_ONLY..
uninstall app silently with system priveleges http://stackoverflow.com/questions/10900928/uninstall-app-silently-with-system-priveleges Context context throws SecurityException NoSuchMethodException observer new PackageInstallObserver pm context.getPackageManager Class types new Class Uri.class IPackageInstallObserver.class int.class String.class Class uninstalltypes new Class String.class.. NoSuchMethodException observer new PackageInstallObserver observerdelete new PackageDeleteObserver pm context.getPackageManager Class types new Class Uri.class IPackageInstallObserver.class int.class String.class Class uninstalltypes new Class String.class..
How to get a list of installed android applications and pick one to run http://stackoverflow.com/questions/2695746/how-to-get-a-list-of-installed-android-applications-and-pick-one-to-run mainIntent new Intent Intent.ACTION_MAIN null mainIntent.addCategory Intent.CATEGORY_LAUNCHER final List pkgAppsList context.getPackageManager .queryIntentActivities mainIntent 0 You will get all the necessary data in the ResolveInfo to start a application. You can..
Open another application from your own (intent) http://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent try out Create an intent with action MAIN and category LAUNCHER Get the PackageManager from the current context using context.getPackageManager packageManager.queryIntentActivity intent 0 where intent has category LAUNCHER action MAIN or packageManager.resolveActivity..
How do I determine if Android can handle PDF http://stackoverflow.com/questions/2784847/how-do-i-determine-if-android-can-handle-pdf action. @param context @return public static boolean canDisplayPdf Context context PackageManager packageManager context.getPackageManager Intent testIntent new Intent Intent.ACTION_VIEW testIntent.setType MIME_TYPE_PDF if packageManager.queryIntentActivities..
How to get app install time from android http://stackoverflow.com/questions/2831333/how-to-get-app-install-time-from-android from android i try some method but not success help me. android share improve this question PackageManager pm context.getPackageManager ApplicationInfo appInfo pm.getApplicationInfo app.package.name 0 String appFile appInfo.sourceDir long installed new File..
Download a file with Android, and showing the progress in a ProgressDialog http://stackoverflow.com/questions/3028306/download-a-file-with-android-and-showing-the-progress-in-a-progressdialog com.android.providers.downloads.ui com.android.providers.downloads.ui.DownloadList List ResolveInfo list context.getPackageManager .queryIntentActivities intent PackageManager.MATCH_DEFAULT_ONLY return list.size 0 catch Exception e return false Method's..
Intent to launch the clock application on android http://stackoverflow.com/questions/3590955/intent-to-launch-the-clock-application-on-android intent widget clock share improve this question This code works for my clock widget. PackageManager packageManager context.getPackageManager Intent alarmClockIntent new Intent Intent.ACTION_MAIN .addCategory Intent.CATEGORY_LAUNCHER Verify clock implementation..
How to get the build/version number of your android application? http://stackoverflow.com/questions/4616095/how-to-get-the-build-version-number-of-your-android-application
Open Facebook page from Android app? http://stackoverflow.com/questions/4810803/open-facebook-page-from-android-app fsintents for instance Copy your id Use this method public static Intent getOpenFacebookIntent Context context try context.getPackageManager .getPackageInfo com.facebook.katana 0 return new Intent Intent.ACTION_VIEW Uri.parse fb profile id_here catch Exception..
Supporting Amazon and Android market links inside application http://stackoverflow.com/questions/5480235/supporting-amazon-and-android-market-links-inside-application do this public static boolean isMarket Context context boolean isMarketSig false int currentSig 1 try Signature sigs context.getPackageManager .getPackageInfo context.getPackageName PackageManager.GET_SIGNATURES .signatures for Signature sig sigs currentSig sig.hashCode..
Android - how to get app signature? http://stackoverflow.com/questions/5578871/android-how-to-get-app-signature the PackageManager class http developer.android.com reference android content pm PackageManager.html Signature sigs context.getPackageManager .getPackageInfo context.getPackageName PackageManager.GET_SIGNATURES .signatures for Signature sig sigs Trace.i MyApp Signature..
How turn on camera flash light programmatically in Android? http://stackoverflow.com/questions/6068803/how-turn-on-camera-flash-light-programmatically-in-android can do whatever according to your app. needs For Checking availability of flash in device You can use the following context.getPackageManager .hasSystemFeature PackageManager.FEATURE_CAMERA_FLASH which will return true if a flash is available false if not. See http..
Android - how to unregister a receiver created in the manifest? http://stackoverflow.com/questions/6529276/android-how-to-unregister-a-receiver-created-in-the-manifest component new ComponentName context MyReceiver.class Check if the Component is enabled or disabled int status context.getPackageManager .getComponentEnabledSetting component if status PackageManager.COMPONENT_ENABLED_STATE_ENABLED Log.d receiver is enabled.. Log.d receiver is disabled Enable Disable the component Broadcast Receiver in your case Disable context.getPackageManager .setComponentEnabledSetting component PackageManager.COMPONENT_ENABLED_STATE_DISABLED PackageManager.DONT_KILL_APP Enable.. component PackageManager.COMPONENT_ENABLED_STATE_DISABLED PackageManager.DONT_KILL_APP Enable context.getPackageManager .setComponentEnabledSetting component PackageManager.COMPONENT_ENABLED_STATE_ENABLED PackageManager.DONT_KILL_APP share..
How to support Amazon and Android Market links in same APK [duplicate] http://stackoverflow.com/questions/7683130/how-to-support-amazon-and-android-market-links-in-same-apk boolean isMarketSig false int currentSig 1 I just set this to 1 to avoid any exceptions later on. try Signature sigs context.getPackageManager .getPackageInfo context.getPackageName PackageManager.GET_SIGNATURES .signatures for Signature sig sigs currentSig sig.hashCode..
Detect if app was downloaded from Android Market http://stackoverflow.com/questions/986627/detect-if-app-was-downloaded-from-android-market use test or production server. Here is a small code piece to read the signature of your app try PackageManager manager context.getPackageManager PackageInfo appInfo manager.getPackageInfo YOUR_PACKAGE_NAME PackageManager.GET_SIGNATURES Now test if the first signature..
|