Uninstall app from android device without permission - java

I developped launcher for an android MDM system. I control this mdm system with Api, so I need help to know how can uninstall/install app into device that use this mdm system in background and without the installer permission.
I also need to delete the apk file from android device storage after the install.
How can I do this programmatically in java?
Any one have solution?

For security purpose without the installer permission we cant install/unistall application in android.

It may require device rooted & make your app system. Read this for reference.
Note: this is not recomended if you want publish your app to playstore

Related

How do I build my apk as a system app on Windows?

I have seen many guides online for how to do this, but they are all assuming a linux environment. I am developing using Android Studio on Windows, and am having trouble following these guides. Specifically, I do not know where to find the platform.pk8 and platform.x509​.pem files required for making my keys. The guides all say they are located in build/target/product/security, but I assume this is the corresponding linux directory. Where can I find these files on my windows device?
To have a system app in Android OS you need to sign your APK by the same key which the OS is signed. These key in the Android open source project can find in
build/target/product/security
But each company has got its own key and you cannot access to those key!
You can build your own Android image and load it your own development bard which probably is not easy. Then you have a system key. you can find useful information here
But the main reason if being a system app is to have the privileges of a system app.
What are those privileges? granting all permission and have access to the restricted area and secure setting for example.
So there is another possible way to be a system app.
If you can push(copy) your APK to /system/priv-app/ folder, then Android will grant all system privileges to your app automatically. (to all application in /system/priv-app/ folder not just to your app) .
How you can push your file into /system/priv-app/?
When you have Android Studio probably you can run adb. you can find some information here
You can connect to your android device using adb and through your local network
adb connect deviceip:port
port by default is 5555 and you don't have normal type it.
For connecting to an Android device the device should in developer option. you can find some useful information here
when you connected to your device you check if your device is rooted and the system folder is mountable or not.
/System/ folder is protected by AVB and furthermore, you need to be a root user, so you use the following command
adb root
adb remount
if your device is rooted you can easily push your APK to system folder and have all privileges of a system app.
adb push <yourPackagePath> /system/priv-app/youtPackage/yourPackage.apk
if your device is not rooted you should search for how you can root your device

Android App that listens if other apps crash on device

Is it possible to have an App that works in the background and listens to when another app crashes on my device?
I want my app to notify my computer when it detects that the app I'm using on my device crashed or stopped. If so would what it need to listen too?
A very hacky way would be to write a native binary which monitored Logcat, upload the executable to your device using ADB and launch it using the shell account. Note that this is not an App though.
The Android shell user has enough privileges to view Logcat for all processes and perform network operations, so you could just scan Logcat for the tell-tale messages that indicate that an app has crashed, siphon out the stacktrace from Logcat and then send it over the local network to your PC.
This actually sounds like quite a cool idea. Might have a go at it building it myself :-)
I think you want to create Samsung's Smart App Manager . That track the crashes of all application and show notification to uninstall app or remove.
From Android doc : By default, the system assigns each app a unique
Linux user ID (the ID is used only by the system and is unknown to the
app). The system sets permissions for all the files in an app so that
only the user ID assigned to that app can access them.
Each process has its own virtual machine (VM), so an app's code runs
in isolation from other apps.
By default, every app runs in its own Linux process. Android starts
the process when any of the app's components need to be executed, then
shuts down the process when it's no longer needed or when the system
must recover memory for other apps.
Each and every android application runs in isolation from other apps. So any app can't track the crash log of other app.
The question is : How Samsung's Smart App Manager is doing.
I think samsung smart app only works with Samsungs devices. Root Permission is required to perform such type of action. Samsung's Smart App only have root permission in Samsung's devices.
If you are developing app for custom ROM or Rooted android device then you can otherwise you can't do.
When you upload your apk in the android developer console you have any options including errors options, then when the app crashed in some device they can send a report and you will can see it in de console...

How to make a system app in Android code

I'm trying to make a app that works like a parental control, but doing so, I got stuck in system app permissions, looking about it, I am not able to find anything that tells me that it is possible to do without using a specific ROM for my app. But in the Play Store, has a lot of apps that makes that. In my app, every time that I try to block connectivity, using ConnectivityManager, he gives me:
java.lang.SecurityException: Neither user 10228 nor current process has android.permission.MODIFY_PHONE_STATE.
And the permission is in the manifest. In the manifest, he gives me the error:
Permission is only granted to system apps.
So, I'm asking, how to make a system App in Android code without root the device?
how to make a app that it is a system app in Android code without root the device?
The closest thing to what you describe is for you to create your own custom Android ROM, where your app is pre-packaged as a system app, and convince people to install your ROM on their device, replacing their existing Android installation.
Otherwise, this is not possible. This should be obvious: if everyone could write an app that made themselves be a system app, there would be no value in having a distinction between regular apps and system apps.

Installing Teamviewer silently on android device from a remote location using java

I want to install the TeamViewer software automatically on client's android device remotely using java. I have researched about a number of third party tools for automatic installation of software but the problem is that each one of them needs user interaction/permission in one or the other way.
In my app I will disable the touch of the device after the user logs in and an animation will be displayed based on the real time data from the server. I want to install the software assuming that no user is present at the other end and no response should be needed to install teamviewer.(My app will not there be on Google play.)
I am very new to android development, but through my research I found that .exe file can not be installed on Android as its a Linux based OS.I was planning to keep the Application(.exe) file at server and then try to install it issuing some adb command from my code.
Can someone please tell me how is it possible? How should I proceed? Please help.
Thanks in advance for any help.
There are two way for installing an App on an Android device:
Via ADB. This requires Debugging to be enabled on the device, and the computer the Java program is executed on requires an USB connection to the device (and proper USB drivers) and the device must be "ADB-paired" with the computer if the device has at least Android 4.2. Furthermore you need ADB which is part of the Android SDK and therefore not present on a regular PC. You could ship a version of ADB with your program but ADB is platform specific (Windows, OSX, Linux, ..) therefore you would have to include multiple versions and select on.
Vis Google Play. Once the user is logged-in any app from the play store can be installed to the users's device via web interface. As the Google log-in credentials are required a user must be present to enter them.
Conclusion: What you want is nearly impossible, especially the "without user interaction" part.
You can't install a app from other app without user interactions, that would a big security problem.
The one app that can it is Google Play for obvious reasons.

How can I save my Android application so that the end-user can execute it without the Android SDK

I have recently started programming for the Android platform. I have a simple application which I would like to email to someone so that they can execute the application and check how it works.
I am currently using the Emulator in the Android SDK to execute my application but the person who I am emailing it to does not have Android SDK and it would be a mission to send the whole project folder.
Is there any way that I can send just one file such as an .exe or something that would allow the recipient to execute the application to see how it works.
Thanks so much for your help in advance guys
The "exe" for android is called apk. I suggest you to look at this question. You'll need to build the apk and sign it in order to be able to run it.
If you just want to send it to a user for testing purposes, you can enable the setting in the target android device to allow "unknown sources" (I don't know the proper english name, as I don't have an english android here at the moment). You can find this in the app settings.
In your development environment look for the apk file created by eclipse. Then connect your smartphone to the pc and copy the apk over. Start up a file manager and click on the apk and it will install just like any other app.
If you want to deploy it properly, you have to sign it and probably follow the procedures from google. Since I don't have a fully deployable app yet, I can't say what the procedures is for that, but the google site is very helpfull on all aspects about android programming.
Check the "bin" folder in your project path. There you will have a .apk that you can share with your clients.
If they execute it in an Android mobile phone the application will be installed.

Categories

Resources