Restrict user to delete Android Application - java

i want to make such an application that user is not allowed to uninstall it. As our company is going to launch our own android phone and my application is going to preinstall in it..so that user wont be able to delete or uninstall it.
can anyone tell me how to achieve such a functionlity...?

If your company is going to launch its own android phone, put your application in the android source, like the other native applications (Settings, Gallery, etc). Also, modify the source, so that in Settings --> Manage Applications there is no entry for your application. If you install your application on a device by a installation manager or anything else then a user can uninstall your application. (You can't prevent this).

Related

Android: how to install a downloaded application from our app similar to a playstore

I have an app which runs Web-View and it's sort of similar to play store. I can download applications with that to a specific folder but I'm not finding any method to install that app by itself by giving permissions of course.
similar to blackmart alpha or 9 apps etc.
You can Open an Intent to install the app on download Completed.
But results in a prompt which asks user to install or cancel.
Or
You can execute an adb shell command within your app to install the app silently but you would first have the user to toggle Usb debugging on their phones. But this may result your app to be one linked with security issues and Google Play Store may deal it as Vulnerable and marks it as a Virus.
So deal wisely.

How to disable the "uninstall" button in Android?

In Android some system applications cannot be uninstalled.
Is there any way to configure an application so that it cannot be uninstalled by the user?
I want to hide the uninstall button in app settings, like a system app such as this:
Not really - the only way to achieve this would be to create a custom ROM. The uninstallable apps are "system apps", or apps installed by default. Often, those are unneeded apps added there by the mobile network or the phone producer. Even those can be uninstalled though when you root your phone :)
Your app can disable the Uninstall button by requesting Device Administration permission from the user.
The user cannot uninstall until they remove the Device Administration permission in Settings. In this case your app's DeviceAdminReceiver will be called, giving your app a chance to react.
http://developer.android.com/guide/topics/admin/device-admin.html
I guess you're mainly looking for a technical solution. But as there is no purely technical solution for a wider audience, you might be open for alternatives:
The phone manufacturer and the telecom provider have means to pre-install apps on a phone that cannot be uninstalled. So one way would be to get in contact with them and see if one of them is willing to cooperate with you. You'll probably need to offer them something in return.

Android automatically download and install apk

we have our android application which is running in kiosk mode. We would like to have feature to automatically check for updates, install those updates and run application again.
We can use some android service for that (actually, that's preferable way).
Do anybody has idea how we can accomplish that?
Thank you.
When the user has activated the auto update option in Play Store, then your update will automatically installed once the user has Wifi. If the user hasn't set this option you can do nothing about that.
You can ping your API every time your app starts, and your API has to tell you whether there is a new version. With this information you can display a popup to the user which forwards him to your PlayStore entry. But the user must select to update your app, you can not automate this process.
What you could do: If you write an HTML5 app, or you have a WebView which loads content from the network, then you can do your magic updates by simple updating the sources on server side.

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 to read database of another application

I am working on a rooted device.
I have connected with the adb shell from my pc and I can verify that the other database exists and I can query its tables.
However in the my java code when I try to open the database I get error
android.database.sqlite.SQLiteException: unable to open database file
I am trying to open the database like this:
SQLiteDatabase.openDatabase(PATH, null, SQLiteDatabase.OPEN_READONLY);
The path is something like /data/data/com.xxx.xxx/databases/xx.db
Am I supposed to read the databases of other applications like this or there is another way?
UPDATE:
I also tried making the system app as adviced in this thread Push my apk to /system/app
I think it works because the app cannot be uninstalled after that from the applications manager like the ordinary apps so I think it is a system app. But still I cannot access the database though I am sure the paths and permissions are ok.
Android OS by default does not allow applications to access each others private folders. To be able to read files that are in another applications folder either:
1) you need to have both applications installed using same user id. Add this to both manifests:
android:sharedUserId="com.xx.xx"
2) If other app is a 3rd party app then your only choice is to install your app as system application. To do that you need a rooted phone and you need to mount the system folder. And then you need to put your application into /system/app/ folder and reboot the phone. It should be installed automatically during the boot.
I would assume that the permissions on the database files are set such that your application has no acess. Even if your device is rooted it doesn't mean that your application is running as root.
This is because the app needs root, and needs to change the permissions of the database you are trying to access so that you can actually access it. What you will need to do is, as root, change the permissions of the database so that everyone can access it, do what you would like on the database, close the database and change the permissions back.
This does circumvent security of android, so proceed at your own risk. You can find a code sample at:
http://rratmansky.wordpress.com/?p=259&preview=true

Categories

Resources