I've written an Android App which is primarily targeted to Android Tablets without the Market installed, which means the user cannot easily update the App. My idea is to download the apk file and do whatever the MArket is doing with the apk file.
As the app is preinstalled on the Tablets there is no restriction in Permissions, but the device must not to be rooted.
Seems the following code allows the user to install the apk after detecting a new version and downloading the apk file:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivity(intent);
well i think that you just can do something like these. Verify version if version is lower app don't run.
Related
How can i write a function that can remotely self-destruct it, ie delete that application from the phone?
Intent intent = new Intent(Intent.ACTION_DELETE);
intent.setData(Uri.parse("package:com.example.myapplication"));
startActivity(intent);
This code does not work on Android 10+
You can purge application files by enumerating app directory and deleting everything in there plus removing your application files on SD card. Uninstalling application itself is a different beast altogether. Non system apps cannot do that AFAIK (starting from android 2.0?).
I am developing an Android app which has the android.intent.category.HOME intent filter in AndroidManifest.xml.
The same app installs without an issue on a spare Android 7 device that I have in hand, but won't install on my Android 9 TV Box -- until I remove the said intent filter from the manifest.
I'm getting an INSTALL_PARSE_FAILED_MANIFEST_MALFORMED failure on ADB, with the following message:
Don't allow install The third Launcher
I guess the exception somehow comes from the PackageParser.java, but I don't know where exactly.
If I remove the launcher (i.e. HOME) intent filter from my manifest file, the app installs successfully without any failures.
Looking through similar SO answers yielded no results, and Google suggests issues with OEM builds.
The question is, how can I investigate and solve this issue?
UPDATE: I can confirm that this limitation is sadly put into effect by the Chinese device manufacturer.
P.S. This seems to be a common issue with these Android TV boxes, found here and here.
Also, as a workaround, if I manually replace the installed /data/app/*.apk file with another build that has the HOME intent filter, the application can work as a launcher just fine. This actually shows that the issue is with the PackageParser, not the installation itself.
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();
i just made a simple android app with 6 buttons. Each button on click opens a new activity. I installed the app on my device via USB cable from Android studio and it runs fine on my device.
But here rises the problem, when I installed the app on my friends device after sharing via SHAREit the app installed on his device but did not run.
What could be the reason for this? And how can I solve this?
Please help. Thank you
You dont need to create a signed APK if you only want to test it on your friends device and not to run it in a production progress. Android Studio creates an apk automatically which is signed for 365 days. Just open your project in your explorer and go to [ProjectName]\app\build\outputs\apk and select the app-debug.apk.
Make sure instance run in android studio is disabled.
Because if Instance run is enabled when you debug the app on real device through usb debugging it will work properly . but if u share the apk from your device to other device it will not work. It might show an error . App Name Unfortunately Stoped.
If Instance run is enable. you must disable the instance run first. If you don't know how to disable it just google it. After disable the instance run, you must clean project and Build new apk. It will work on all the other devices without generating signed apk.
Hope it may help you.
While building the app what MinSDK version you defined? Do both devices satisfy that criteria?
If you suspect that installing through sharing app is a problem then try attaching your friend device to your laptop and try running the app.
Or
Send the apk through email and let your friend download the apk and install the apk through apkInstaller app.
I have a solution for you:
Install Bluestacks Android Emulator.
Go to Tools, Android and click on Enable Adb Integration to disable it.
In android studios one Android Device for Bluestacks will appear while installation.
Share the installed app through shareit.
It will work on other device.
Hope it helps
Here is the link, where you will find your solution. https://developer.android.com/studio/publish/ check the point 'publish your app', In left column.
Simply follow these steps:
Double click on shift and search for build apk and click on it.
Locate that apk file.
Copy to your physical device or your friend's device... whatever, it will work.
I have struck an idea of creating an app that automatically installs all the .apk packages placed inside a particular folder. In context to this, I want to learn how do I programmatically access installer service ?
Please enlighten me in this regard.
Your best bet would be to set an intent with type application/vnd.android.package-archive and then start installer activity:
Intent promptInstall = new Intent(Intent.ACTION_VIEW)
.setDataAndType(Uri.parse("file:///path/to/your.apk"),
"application/vnd.android.package-archive");
startActivity(promptInstall);
Check out Install Application programmatically on Android
Also, note, that for security reasons, you cannot install an apk 'silently' or automatically without user agreement. Therefore, the best you can do is like above.