android-package-managers

Install APK programmatically on android

蓝咒 提交于 2019-11-27 12:35:15
问题 I've been trying to get an android application to install an APK on the sdcard programmatically but I'm running into a little trouble. This is how I'm doing it: Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType("ApkFilePath...","application/vnd.android.package-archive"); activity.startActivityForResult(intent,5000); Now that works ok, it brings the package manager and I can control what to do when the manager finishes installing the APK. But the issue that I'm having is

What does this mean: Failure [INSTALL_FAILED_CONTAINER_ERROR]?

浪尽此生 提交于 2019-11-27 10:35:05
I try to deploy my app and sometimes get this error: Failure [INSTALL_FAILED_CONTAINER_ERROR] I tried to google it but don't find what the error means or what it's caused by. I deploy via IDE (IntelliJ) the file gets copied to the device to the /data/local/tmp (unrooted Huawei Ideos, running 2.2), but the package manager doesn't seem to like it. Before installing the apk, I already removed the app from the device beforehand. I also made sure there was no old file under /data/local/tmp on the device. Still I'm getting this error now. The package should be signed with the debug key, since I

Turn off notifications of an app programatically on Android

淺唱寂寞╮ 提交于 2019-11-27 06:54:40
问题 I am developing a package manager application which shows checkboxes to turn off notifications from different applications installed on the Android device. Since Android 4.1, users can turn off notifications of an app from application manager. Can I turn on/off notifications from an app programatically? Is there an API for doing that? 回答1: No, you cannot do that from your code. Perhaps on rooted devices you could do some magic, but that shall not really count for wider audience. 回答2: If you

Android: How to get a list of installed activities, as they appear in launcher, without duplicates

会有一股神秘感。 提交于 2019-11-27 05:22:11
问题 I am writing an app that allows user to view the list of installed apps, select one of them and then start it on schedule. Using tutorials from stackoverflow i managed to figure out how to get a list of installed activities, their package names and icons(i.e. here - several ways to do it). Just in case, this is how i start activities, it works flawlessly, no problem here: Intent launchIntent = packageManager.getLaunchIntentForPackage(packageName); launchIntent.setAction(Intent.ACTION_MAIN);

Get Preferred/Default app on Android

[亡魂溺海] 提交于 2019-11-27 02:26:44
问题 I am trying to get the default/preferred application for a given Intent . For example, when the user installs a second web browser, then attempts to open a URL, he or she will get a dialog like this: If the user then selects the Use by default for this action option, then the dialog box no longer opens when a URL is pressed. I am working on an application that should be aware of what this default or preferred app/action is. How do I do this? I am currently using the code below, but

How to find the package name which has been uninstalled when using Intent.ACTION_PACKAGE_REMOVED

拥有回忆 提交于 2019-11-27 02:19:35
问题 I have an application which is keeping a log of internally developed applications installed on the device. Upon installation a broadcast receiver for Intent.PACKAGE_ADDED is invoked and records the package name using the following code: public class NewInstallReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Bundle b = intent.getExtras(); int uid = b.getInt(Intent.EXTRA_UID); String[] packages = context.getPackageManager().getPackagesForUid

Get Recent and Running application list not processes

柔情痞子 提交于 2019-11-26 23:22:58
问题 I tried a lot to get the list of recent and running applications(not processes) but couldn't get it. I went through all the stackoverflow questions regarding this but the only answer i got about the running processes and recent tasks not the application specific like we can see in Samsung Mobile task manager on long press of home button. I am able to get the Running processes by this code : ActivityManager actvityManager = (ActivityManager) this.getSystemService( ACTIVITY_SERVICE ); List

How to get the list of apps that have been installed by a user on an Android device?

♀尐吖头ヾ 提交于 2019-11-26 19:31:33
问题 I am using the following piece of code at the moment: List<PackageInfo> packs = getPackageManager().getInstalledPackages(0); but it returns Apps that have been installed by the both device manufacturer and me. How to limit it so that only the apps that I installed are returned? 回答1: // Flags: See below int flags = PackageManager.GET_META_DATA | PackageManager.GET_SHARED_LIBRARY_FILES | PackageManager.GET_UNINSTALLED_PACKAGES; PackageManager pm = getPackageManager(); List<ApplicationInfo>

Android 6.0: Get package name of current activity [duplicate]

白昼怎懂夜的黑 提交于 2019-11-26 17:25:11
问题 This question already has answers here : Package name of current running application package name Android 6.0 [duplicate] (1 answer) How to get package name from anywhere? (12 answers) Closed 3 years ago . How to get current activity package name? as getRunningAppProcesses() not working in Android 6.0. Below is my code: grdPhoto.setOnItemClickListener(new AdapterView.OnItemClickListener() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onItemClick(AdapterView<?> parent, View

Can PackageManager.getInstallerPackageName() tell me that my app was installed from Amazon app store?

吃可爱长大的小学妹 提交于 2019-11-26 16:08:00
问题 I plan on publishing my app on Amazon app store as well as Google Play, and have some things in my app that need to behave slightly different depending on whether the app was installed from Amazon app store or not. If I understood the PackageManager.getInstallerPackageName(String packageName) method correctly, it tells me the name of the application that installed my app. Right? If so, does anyone know what the value returned by this method would be if my app was installed from Amazon app