How do I set my application to default on a rooted device - android

We have a tablet app that we're deploying at retail outlets. It currently self updates late at night but after it does it is no longer the default "home" application and the user is given the choice to start our app or the default launcher again. We'd like to always have our app be the default home application even after updates. Is there a way to do this on a rooted device?
This is an ICS based device so the addPreferredActivity doesn't seem to work as I cannot get the android.permission.SET_PREFERRED_APPLICATIONS permission even though the device is rooted. If there is a way around that, I think I could get this done..

Is there a way to do this on a rooted device?
The simplest solution is the one you rejected from the comment: remove the stock launcher and make yours be the only launcher.
This is an ICS based device so the addPreferredActivity doesn't seem to work as I cannot get the android.permission.SET_PREFERRED_APPLICATIONS permission even though the device is rooted.
Root, by itself, has nothing to do with permissions. In this case, SET_PREFERRED_APPLICATIONS is a signature-level permission, meaning that your app would have to be signed by the same signing key as the firmware, which will not be possible unless you roll your own modded ROM.
If I am reading the Android source code correctly, the results of addPreferredActivity() wind up in /data/system/packages.xml, in a <preferred-activities> element. Play around with modifying that file very carefully and see if that will get you what you want.

Sometimes it happens that some application cant work properly in rooted device i also had same kind of problem in my device (was also Rooted).so i had only one way remain that to install os again so i did it with use of some software (like superoneclick) and with use of it i unroot my device and reinstall os. then the application works perfectly so may be u should also unroot your device if its possible.

Related

Device Administrator rights disabled on phone restart

I have created an android application with device admin rights. It was working properly on my Moto G and many other devices. In Sony Xperia C, the device administrator rights disabled automatically on phone restart. Is anyone come across such issue? and how to fix them?
There may be other ways of doing it, but what springs to mind is a startup script. There's an interesting article here on creating them, which you might use to automatically set admin permissions to your app.
My app had a similar problem on this phone and I think I've worked out what is happening.
If the user moves the app from internal memory to the SD card, the app can lose its Device Administrator privileges when the SD card is unmounted. This would likely happen when the phone is restarted.
According the Android documentation, if you don't specify an installLocation in the manifest, an app should not be moveable. I think some phones break this rule and allow an app to be moved anyway.

Why would Android 2.2 reboot after install of an .apk file?

I am getting reports from beta testers that after installing my .apk file their device is rebooting. After reboot the application operates as normal. Reboot after installation is not part of the desired/expected behavior, and itself sounds like a security breach.
Can anyone speculate as to why Android might reboot after an .apk install?
UPDATE:
One of the devices was an LG Ally, the other was a Samsung Galaxy Note
Are your Beta users using a rooted device? Do they have some kind of security app like "Lookout" installed on their device?
I'd suggest that you make your app create a trace log on the sdcard, that you'd get your beta tester to email to you.
Of course, this debugging process would be easier if someone loaned you the same model of the device your beta user is using.
No matter what your app should never be able to crash the operating system. A lot of this can depend on the device and manufacturer. For example, I noticed that when using a certain app to stream music on 2.3.x on the Droid X, the device would sometimes restart. I could not fix this issue myself but instead had to wait until a fix was provided by Motorola (which it eventually was). I would see if you can find a common occurrence on certain devices or manufacturers then do some researching on their reported bugs page. Also, what type of application is this (game/media/utility?)

In Android, preinstalled apps are always disable to uninstall?

Just that, I like to know is always all the preinstalled apps are with the uninstall button disable in Android.
If I am reading your question correctly, some of the pre-installed apps can't be uninstalled without rooting your phone using cyanogenmod or rooting your phone.
Some pre-installed applications can be uninstalled. For example in Android 4 (ICS) you can go to Settings -> Apps and select the "All" tab. There you can uninstall some of the preinstalled software.
Root the phone, put the APK into the /system/app folder and then unroot the phone. This is possible on a Droid 4 at least in theory. Not sure about other hardware models. If you can root and unroot the phones it should work.
This depends on the Device manufacturer. They have the possibility to install the app in any way they like before they freeze the image and flash it to the hardware in the factory.
For example some of the Branded apps might be installed under system privileges, but some of the more "friendly recommendation" apps might be free to uninstall.
From what i understand in ics apps in usolder can be uninsfreeled, apps in system folder instead of uninstall the button reads disable. Except for only s slight few only, these apps are reQuired by the os for the user to be able to"enable" a disable App, so i think i the app needs to be signed by the room cooker our needs top have a intent in the manifest like a launcher or home app (since if you disable your home launcher you bricked your phone, so you can't disable it, but if you give your app a intent label of copied from the Android source launcher then the phone will think it's a launcher, and not let you disable it, you will prob have to set the home launcher back to be default or Android will ask you witch launcher too use Every time user hits the home button, i was looking for the same answer found this page
Android 4.0 Api to Disable Apk Witch gave me the idea, currently thus reply is closest I've come to impinging the idea, i well be trying it soon, if you beat me to it, let me know tour results, and i well do the same.
And to install a app in /system/app a uninstall.zip won't do it, you need too root the phone, install the app, xfer it to system (i use system/app mover available in the play store free, the too secure ot Unindtsll app mover, and unroot, any way good luck.
P.s. I'm Not a Dev, i just understand the format format of the app language, and can c effectivly search for info, so please no code questions. i can't answer them, but google can.

How to find whether an Android stack in phone is Original or Jail-broken?

I would like to know how to find whether an Android stack in phone is Original or Jail-broken?
My Intention :
My application will check for the genuineness of the Android OS in phone.
If it finds that, the phone does not have a genuine Android, it will not allow the application to install on phone.
Is it possible to implement this?
Thanks,
Sen
Check if you can "su" on the phone with an installer application. If you can't, install your apk as you please.
You cannot prevent installation of your app - there are no pre-install hooks for you to do that.
What you can do however, is use #Nacho L's method once installed to prevent your app from running.
Of course, if the phone is rooted, then there's nothing you can do to prevent your app from running if the user is determined to run it.

How would you uninstall a rogue Home (Launcher) application?

If you were to install a Home Screen application that does not give you access to the System Settings screen (to go to Manage Applications), and also does not let you launch Apps (such as the Market App or 3rd party install/unistallers), is there ANY way to uninstall such an application?
I know that Android requires your permission before letting a new App take over the home screen privilege. But say you're trying a newly published Launcher app that is buggy (or malicious). You are of course still going to tell Android it's ok to give this App the Home screen privilege. Now once it is installed, your phone is now effectively useless?
Is there a way for a typical end user (who doesn't have Eclipse/ADB) to get out of this situation? Other than doing a complete factory reset?
I realize there are ways to uninstall an App via ADB ("adb uninstall package.name")
But it seems like a typical end user is potentially screwed if they ever install such a malicious/buggy app. This seems like a gaping security hole in Android, no?
You are right, there is no nice way of uninstalling such an application from the Android device itself. The only solutions are the ones you are mentioning, factory reset (which is difficult for most users, if the settings menu is not accessible) or using adb.
I wouldn't call it a security issue, but it could certainly be a problem for users that are not careful about what they are installing.
One of the big selling points about Android, that really puts the system way ahead of the competition, is the possibility to replace any app you don't like with something you download and install yourself. ("All applications are created equal.")
The price to pay for this freedom is that there are rogue applications that will try to take over.
Someone on StackExchange posted a very helpful solution to this problem. It seems that in addition to a factory reset, most phones also support a Safe Mode that disables other Home/Launcher apps that have been installed (at least that's what it did on my Droid X). This allows you to then uninstall the offending application. Then simply reboot again back into normal mode to get your old phone back.
There's actually an easier solution these days, surely? Use the market.android.com website to install a new homescreen app remotely onto your device. Once you've done this, hitting the home button will once more bring up the list of homescreen apps to choose from, and you can select a non-malicious, non-buggy one, and then use that to uninstall the evil one.

Categories

Resources