Uninstall an Android app programmatically without prompt interaction? - java

I'm developing an Android app.
I used the following code to uninstall a specific application.
Intent intent = new Intent(Intent.ACTION_DELETE); intent.setData(Uri.parse("package:com.example.tharindurasanga.locationtracker"));
startActivity(intent);
This code really works fine but not giving what I'm expecting since this is resulting a prompt saying user to confirm the app uninstallation. I need to uninstall the app silently without user confirmation.
Can someone suggest me another method of doing this or help me to remove this prompt?

Related

Java Android Runtime.getRuntime().exec()

I'm working on an app where I want to run an android shell command using:
Process process = Runtime.getRuntime().exec("input keyevent 85");
This should start/stop the music player for me, and it works when I'm currently on my app.
The way I do it is to set a prepared intent beforehand at a certain time, so I can have the music playing in a few minutes.
However, it doesn't work when I have the app running in the background. The intents do print out my Log.i messages in Logcat, so I'm not sure where the problem lies. Perhaps it is a permission problem?
Turns out, using this method, the APK would have to be signed, the device rooted and the APP be placed in the directory of system apps.

Uninstall APP using its APK

I need to trigger an uninstall of a certain app from within my own app. The only thing i have is the apps apk, even tho it doesn't have to be the same version as the installed app.
The uninstall would be handled by android of course. Just like installing an app from a given apk file.
Is there a way how i can put together an intent to make android open the responsible system service and and ask the user to uninstall or something like that?
The app to be uninstalled can change, so i can't use a constant packagename or something like that.
Is there some way to do this? I know you can extract the packagename from an apk, but it seems like a lot of work and probably overkill.
Using Intent.ACTION_DELETE intent
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:com.example.mypackage"));
startActivity(intent);
You can get your own package name from context;
getApplicationContext().getPackageName();

Android - 'Complete action using' keeps showing even after selecting 'Always'

I'm trying to use an intent to browse for images. I managed to get my code working but the only problem is that every time I choose the browse file button, the app always shows the pop up dialog 'Complete action using' even after Always is selected.
I still want the user to select from the available app installed and set it as default when 'always' is selected.
Do I need to programmatically save the user's choice? I have only tested this in Genymotion's emulator (Android's Studios emulator is very slow in my laptop) and my Lenovo S820 Android 4.4.2. Is it a specific bug in my phone or am I missing something? Thank you in advance.
I have searched everywhere and found this similar
question, but it's also unanswered.
I am calling my intent like this:
public Intent browse(){
Intent getterIntent = new Intent(Intent.ACTION_GET_CONTENT);
getterIntent.addCategory(Intent.CATEGORY_OPENABLE);
getterIntent.setType("image/*");
return getterIntent;
}

Message while app is deleted

I want to know why users delete my app. So, I what to know why users do it. Is it possible to ask the user why they deleted my app? API something like ACRA library.
It´s not!
When an Android-APP was uninstalled there is an INTENT coming up.
http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED
So every other App might be able to recognize your app beeing uninstalled but not your app itself.

Error in LogCat while developing a barcode scanner for android

I followed the steps provided in the Zxing project. I have created a single button to scan a barcode. I am using emulator in Eclipse and I am having a webcam(according to the suggestion of #Sean Owen) which would do the image capture for me. While running the project after I click the scan button a prompt's asking whether I want to install an existing separate app named Barcode Scanner which is needed to begin the scan process. So, as soon as I choose the yes option the project crashes and shows that the application stopped working. Also I am having the following error in LogCat. Any help would be appreciated.
Its simple I guess. You don't have the Google Play app installed on your device. Either try to install it or find a device which has one installed.
You do not have the app that can handle the intent for barcode scanner.Go to the Google Play app and install one barcode scanner.Check if the issue persists

Categories