tags:

views:

929

answers:

5

Does anyone know if there's a way to either keep the user from uninstalling an app from an Android phone or reinstall it on removal? Before you flame me, please know that I have an app that's intended to be installed on the phone by a parent/employer/etc. and has a password-protected settings screen; the user would need to enter the password to remove the app.

+2  A: 

I'd highly doubt that's possible. The permission structure of Android is going to give the user full control over what's happening on their phone (to some degree) and not being able to uninstall an app would be a pretty large security risk.

If you modified the Android core, it would probably be possible, but if you're trying to force something onto an end-user, that's a bad idea.

Maybe there's a better approach to what you're doing? If there's some required functionality in the app to keep the user from uninstalling it, that would be a small incentive to keep the app, but there's no way to keep a user from removing something they really don't want. You could have the app report uptime to a seperate server so you could be notified if the app was removed, but I think that's as far as you're going to get.

Alex Fort
Here's a link to the site for app: http://www.textecution.com. It's kind of a "Big Brother"-type app; it's really supposed to be installed on the phone by a parent or employer, and the phone user might not want it on there.
Jarett
I would sure like to see the reaction when the teenager installs it on Dad's phone :)
gbarry
+4  A: 

What if you have it send an email alert to a registered email address on uninstall?

EBGreen
Do you know if there's a broadcast sent on uninstall that the app can grab?
Jarett
From the way you wrote the question I thought it was your app.
EBGreen
It isn't mine, per se, but I did write it.
Jarett
So doesn't that mean that you control the uninstall code?
EBGreen
Not really. Uninstalling apps is done through the system menus, not through the actual app.
Jarett
That's lame. So there is no way for an app to explicitly clean up after itself?
EBGreen
There might be a broadcast sent when the app is uninstalled. If your app has the correct permissions, it can be set to receive the broadcast and run some code before it's uninstalled...I think.
Jarett
A (pretty crappy) workaround might be to have your app send a 'heartbeat' e-mail every day. When the parent stops getting the e-mails, they know something's up.
Outlaw Programmer
+2  A: 

Not without modifying the kernel, or reducing the user priviledges on the device. Think of it as a Linux computer, where the cell phone user has root.

Can you prevent them from removing your app? No.

But you can make it painful and difficult enough that it's not worth it, and include alerts that indicate it has been removed.

First, I would modify the software so it requests and successfully answers a cryptographic challenge/response periodically from a remote server - daily should be enough, and wouldn't impact battery use. This way your server knows when it has been disabled (could be sold as an additional $10/yr service charge) and you can alert the purchaser.

Second, I would tie the software into the system at the driver level so that removal also removes text services. There are drivers or services that the texting application uses that could be replaced with your custom versions, and on removal would render the texting app useless. Chances are good that you already tie into the system in a similar way to block the texting app (and other apps) while traveling too fast.

Third, I would consider installing a monitoring program that runs as a separate process (check out how the latest viruses operate for clues). It would check to make sure that not only is the app still running, but it's running the latest version, and there isn't a GPS simulator or other program that prevents your app from getting correct GPS data.

I'm curious how you differentiate between the driver texting and a friend in the passenger seat texting on the driver's cell, though.

Adam Davis
Wow, thanks for the very thorough reply. Having the app install another app that watches for uninstall might be feasible, but also might be draining on the battery depending on how it worked; I'd have to look into it a bit. As for differentiating passengers, see http://www.textecution.com/faqs.php.
Jarett
You wouldn't need the side program running all the time - in fact it might be harder to notice if it isn't running constantly. Run it periodically, and on startup to see if it's still in cron (or similar) and installed. You might also be able to attach it to charging or other events.
Adam Davis
+2  A: 

On the topic of email notification when your service is uninstalled--

A lot of security software runs multiple processes which monitor each other, so that it's more difficult to shut the system down. You could do something similar with two services installed, each monitoring to see if the other is installed. If something goes wrong, they can send off the e-mail.

tsellon
A: 

hi i have the same problem i find that if we move our app in system/app folder. than app can prevent from remove. but when i do this from adb push,it is giving error of read only data. can anyone help me??

nimi
This is not to be posted as an answer. A comment maybe.
kiki
hi..thanks for guidance....i have the same problem..plz solve
nimi