¡@

Home 

2014/10/16 ¤W¤È 08:14:12

android Programming Glossary: getpackagemanager

How to change an application icon programmatically in Android?

http://stackoverflow.com/questions/1103027/how-to-change-an-application-icon-programmatically-in-android

3 . Set programmatically ENABLE attribute for necessary getPackageManager .setComponentEnabledSetting new ComponentName ru.quickmessage.pa..

How to check if the application is installed or not in android programmatically

http://stackoverflow.com/questions/11392183/how-to-check-if-the-application-is-installed-or-not-in-android-programmatically

if the package is already installed Intent LaunchIntent getPackageManager .getLaunchIntentForPackage com.Ch.Example.pack startActivity.. boolean appInstalledOrNot String uri PackageManager pm getPackageManager boolean app_installed false try pm.getPackageInfo uri PackageManager.GET_ACTIVITIES..

READ_LOGS permission on Jelly Bean (api 16)

http://stackoverflow.com/questions/11461650/read-logs-permission-on-jelly-bean-api-16

getPackageName String CMDLINE_GRANTPERMS su c null if getPackageManager .checkPermission android.Manifest.permission.READ_LOGS pname..

how to set the output image use com.android.camera.action.CROP

http://stackoverflow.com/questions/12758425/how-to-set-the-output-image-use-com-android-camera-action-crop

intent.setType image List ResolveInfo list getPackageManager .queryIntentActivities intent 0 int size list.size if size 0..

Using the Android RecognizerIntent with a bluetooth headset

http://stackoverflow.com/questions/14991158/using-the-android-recognizerintent-with-a-bluetooth-headset

to launch speech recognition in Android PackageManager pm getPackageManager List ResolveInfo activities pm.queryIntentActivities new Intent..

Getting installed app size

http://stackoverflow.com/questions/1806286/getting-installed-app-size

use reflection to invoke getPackageSize PackageManager pm getPackageManager Method getPackageSizeInfo pm.getClass .getMethod getPackageSizeInfo..

Android: Get Selected Item Using Checkbox in Listview when I click a Button

http://stackoverflow.com/questions/18162931/android-get-selected-item-using-checkbox-in-listview-when-i-click-a-button

applicationInfo getApplicationInfo PackageManager pm getPackageManager List PackageInfo pInfo new ArrayList PackageInfo pInfo.addAll.. applicationInfo getApplicationInfo PackageManager pm getPackageManager List PackageInfo pInfo new ArrayList PackageInfo pInfo.addAll..

android: how do i open another app from my app?

http://stackoverflow.com/questions/2923265/android-how-do-i-open-another-app-from-my-app

see if it is ahead of time PackageManager packageManager getPackageManager Intent intent new Intent Intent.ACTION_VIEW intent.setType application..

Android: change default Home Application

http://stackoverflow.com/questions/3836215/android-change-default-home-application

is my code private void makePreferred PackageManager pm getPackageManager IntentFilter f new IntentFilter android.intent.action.MAIN..

Android Launch an application from another application

http://stackoverflow.com/questions/3872063/android-launch-an-application-from-another-application

can be used to start the application. Intent LaunchIntent getPackageManager .getLaunchIntentForPackage com.package.address startActivity..

Detect an application is installed or not?

http://stackoverflow.com/questions/3922606/detect-an-application-is-installed-or-not

a Context class e.g. an Activity or a Service you can call getPackageManager . This gives you a variety of methods one of which is getPackageInfo.. isAppInstalled String packageName PackageManager pm getPackageManager boolean installed false try pm.getPackageInfo packageName PackageManager.GET_ACTIVITIES..

Enable GPS programatically like Tasker

http://stackoverflow.com/questions/4721449/enable-gps-programatically-like-tasker

gps. private boolean canToggleGPS PackageManager pacman getPackageManager PackageInfo pacInfo null try pacInfo pacman.getPackageInfo com.android.settings..

Enable and disable a Broadcast Receiver

http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver

inside a service. PackageManager pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver.. ComponentName EditPreferences.this OnBootReceiver.class getPackageManager .setComponentEnabledSetting component flag PackageManager.DONT_KILL_APP..

Custom filtering of intent chooser based on installed Android package name

http://stackoverflow.com/questions/5734678/custom-filtering-of-intent-chooser-based-on-installed-android-package-name

List ResolveInfo resInfoList getPackageManager .queryIntentActivities myIntent 0 At this point I want to filter..

Install apps silently, with granted INSTALL_PACKAGES permission

http://stackoverflow.com/questions/5803999/install-apps-silently-with-granted-install-packages-permission

You'll need to get package manager object via Context 's getPackageManager . Then you will call installPackage function via reflection...

install / uninstall APKs programmatically (PackageManager vs Intents)

http://stackoverflow.com/questions/6813322/install-uninstall-apks-programmatically-packagemanager-vs-intents

new Intent Intent.ACTION_DELETE Uri.fromParts package getPackageManager .getPackageArchiveInfo apkUri.getPath 0 .packageName null startActivity..

Android: Taking complete control of phone(kiosk mode), is it possible? How?

http://stackoverflow.com/questions/7121508/android-taking-complete-control-of-phonekiosk-mode-is-it-possible-how

void launchApp String packageName Intent mIntent getPackageManager .getLaunchIntentForPackage packageName mIntent.addFlags Intent.FLAG_ACTIVITY_CLEAR_TOP..

How to change an application icon programmatically in Android?

http://stackoverflow.com/questions/1103027/how-to-change-an-application-icon-programmatically-in-android

android.intent.category.LAUNCHER intent filter activity alias 3 . Set programmatically ENABLE attribute for necessary getPackageManager .setComponentEnabledSetting new ComponentName ru.quickmessage.pa ru.quickmessage.pa.MainActivity Red PackageManager.COMPONENT_ENABLED_STATE_ENABLED..

How to check if the application is installed or not in android programmatically

http://stackoverflow.com/questions/11392183/how-to-check-if-the-application-is-installed-or-not-in-android-programmatically

if installed This intent will help you to launch if the package is already installed Intent LaunchIntent getPackageManager .getLaunchIntentForPackage com.Ch.Example.pack startActivity LaunchIntent System.out.println App already installed on.. System.out.println App is not installed on your phone private boolean appInstalledOrNot String uri PackageManager pm getPackageManager boolean app_installed false try pm.getPackageInfo uri PackageManager.GET_ACTIVITIES app_installed true catch PackageManager.NameNotFoundException..

READ_LOGS permission on Jelly Bean (api 16)

http://stackoverflow.com/questions/11461650/read-logs-permission-on-jelly-bean-api-16

app after that for the change to take effect though String pname getPackageName String CMDLINE_GRANTPERMS su c null if getPackageManager .checkPermission android.Manifest.permission.READ_LOGS pname 0 Log.d TAG we do not have the READ_LOGS permission if android.os.Build.VERSION.SDK_INT..

how to set the output image use com.android.camera.action.CROP

http://stackoverflow.com/questions/12758425/how-to-set-the-output-image-use-com-android-camera-action-crop

public void doCrop Intent intent new Intent com.android.camera.action.CROP intent.setType image List ResolveInfo list getPackageManager .queryIntentActivities intent 0 int size list.size if size 0 Toast.makeText this Cant find crop app .show return else intent.setData..

Using the Android RecognizerIntent with a bluetooth headset

http://stackoverflow.com/questions/14991158/using-the-android-recognizerintent-with-a-bluetooth-headset

with a bluetooth headset I use the following code to launch speech recognition in Android PackageManager pm getPackageManager List ResolveInfo activities pm.queryIntentActivities new Intent RecognizerIntent.ACTION_RECOGNIZE_SPEECH 0 if activities.size..

Getting installed app size

http://stackoverflow.com/questions/1806286/getting-installed-app-size

AIDLs into our project and generate the stubs. You can then use reflection to invoke getPackageSize PackageManager pm getPackageManager Method getPackageSizeInfo pm.getClass .getMethod getPackageSizeInfo String.class IPackageStatsObserver.class getPackageSizeInfo.invoke..

Android: Get Selected Item Using Checkbox in Listview when I click a Button

http://stackoverflow.com/questions/18162931/android-get-selected-item-using-checkbox-in-listview-when-i-click-a-button

ListView findViewById R.id.listApplication ApplicationInfo applicationInfo getApplicationInfo PackageManager pm getPackageManager List PackageInfo pInfo new ArrayList PackageInfo pInfo.addAll pm.getInstalledPackages 0 AppInfo app_info new AppInfo.. MainActivity.this result 1000 .show ApplicationInfo applicationInfo getApplicationInfo PackageManager pm getPackageManager List PackageInfo pInfo new ArrayList PackageInfo pInfo.addAll pm.getInstalledPackages 0 app_info new AppInfo pInfo.size..

android: how do i open another app from my app?

http://stackoverflow.com/questions/2923265/android-how-do-i-open-another-app-from-my-app

PDF Toast.LENGTH_SHORT .show or Query the Package Manager to see if it is ahead of time PackageManager packageManager getPackageManager Intent intent new Intent Intent.ACTION_VIEW intent.setType application pdf List list packageManager.queryIntentActivities..

Android: change default Home Application

http://stackoverflow.com/questions/3836215/android-change-default-home-application

msg74167.html But I got the same issue this is my code private void makePreferred PackageManager pm getPackageManager IntentFilter f new IntentFilter android.intent.action.MAIN f.addCategory android.intent.category.HOME f.addCategory android.intent.category.DEFAULT..

Android Launch an application from another application

http://stackoverflow.com/questions/3872063/android-launch-an-application-from-another-application

Detect an application is installed or not?

http://stackoverflow.com/questions/3922606/detect-an-application-is-installed-or-not

on the user's device you can use the PackageManager. From a Context class e.g. an Activity or a Service you can call getPackageManager . This gives you a variety of methods one of which is getPackageInfo . Below is a method you might use. You might call it.. this isAppInstalled com.simexusa.campusmaps_full private boolean isAppInstalled String packageName PackageManager pm getPackageManager boolean installed false try pm.getPackageInfo packageName PackageManager.GET_ACTIVITIES installed true catch PackageManager.NameNotFoundException..

Enable GPS programatically like Tasker

http://stackoverflow.com/questions/4721449/enable-gps-programatically-like-tasker

power control widget is one which will allow you to toggle the gps. private boolean canToggleGPS PackageManager pacman getPackageManager PackageInfo pacInfo null try pacInfo pacman.getPackageInfo com.android.settings PackageManager.GET_RECEIVERS catch NameNotFoundException..

Enable and disable a Broadcast Receiver

http://stackoverflow.com/questions/5624470/enable-and-disable-a-broadcast-receiver

anything but I can not enable it. I call the method from inside a service. PackageManager pm getApplicationContext .getPackageManager ComponentName componentName new ComponentName com.app .broadcast_receivers.OnNetworkChangedReceiver pm.setComponentEnabledSetting.. ComponentName component new ComponentName EditPreferences.this OnBootReceiver.class getPackageManager .setComponentEnabledSetting component flag PackageManager.DONT_KILL_APP I use this to disable a BOOT_COMPLETED receiver..

Custom filtering of intent chooser based on installed Android package name

http://stackoverflow.com/questions/5734678/custom-filtering-of-intent-chooser-based-on-installed-android-package-name

of installed packages final Intent myIntent new Intent android.content.Intent.ACTION_MAIN List ResolveInfo resInfoList getPackageManager .queryIntentActivities myIntent 0 At this point I want to filter the list based on a specific string or variation of strings..

Install apps silently, with granted INSTALL_PACKAGES permission

http://stackoverflow.com/questions/5803999/install-apps-silently-with-granted-install-packages-permission

install / uninstall APKs programmatically (PackageManager vs Intents)

http://stackoverflow.com/questions/6813322/install-uninstall-apks-programmatically-packagemanager-vs-intents

startActivity intent Uninstall APK using Intent Intent intent new Intent Intent.ACTION_DELETE Uri.fromParts package getPackageManager .getPackageArchiveInfo apkUri.getPath 0 .packageName null startActivity intent This is obviously not the way e.g. Android..

Android: Taking complete control of phone(kiosk mode), is it possible? How?

http://stackoverflow.com/questions/7121508/android-taking-complete-control-of-phonekiosk-mode-is-it-possible-how

false stopSelf catch Exception e end of while loop protected void launchApp String packageName Intent mIntent getPackageManager .getLaunchIntentForPackage packageName mIntent.addFlags Intent.FLAG_ACTIVITY_CLEAR_TOP mIntent.addFlags Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED..