How can I send Intent to shutdown the phone if I have a rooted phone?
I put the app in system/app but this was not good enough. What more do I have to do?
It says in docs about public static final String ACTION_SHUTDOWN:
This is a protected intent that can only be sent by the system.
What does it mean only sent by the system? If I get my app to get correct UID,
can I do it then? Or can it absolutely never be done even on a rooted phone?
The Android source in GrepCode suggests that before Android 4.0 this was a signature-only permission, but is now signature or system. This means that you either have to be signed with the key that was used to sign the platform (usually OEM apps only) or be in the /system/app folder. In more recent versions of Android this folder is /system/priv-app to allow vendors to distribute built-in applications with different levels of trust.
You can run an adb shell command as root to shutdown the device.
Related
I need to Turn ON/OFF Mobile data programmatically. For this issue I need to use MODIFY_PHONE_STATE permission.
As we know in latest Android versions it's not possible for non-rooted phones unless the app has system rights.
I know that exists some workaround how to sign the app as system app. But as I understand it's not possible to publish such app at the Play Store.
My question is the next - is it possible to get system rights officially? If it is possible which way I have to go to get them?
THe only way to get them is a rooted device, or to build the device image yourself. The idea of system permissions is that only apps which are trusted by the creator of the system (the OEM) can request them. You can also get them by rooting the device, because of how they're granted (its based on the directory the app is installed in, which can be accessed if you have root). But there is no way to do it without root or without creating your own OS image.
MODIFY_PHONE_STATE is a system-only permission so there's no way to get that permission unless you root your phone.
How to create application auto reboot device with not rooted device?
I used method reboot in PowerManager with permission
<uses-permission android:name="android.permission.REBOOT" />
so occur error "neither user 10039 nor current process has android.permission.REBOOT"
May be reason is only system applications and applications signed with the same key that was used to sign the firmware will be able to get that permission.
Please suggest me a better way to create application auto reboot.
You cannot do a reboot from an ordinary SDK application. Only applications signed with the system firmware signing key can do this.
Copied from this answer,
Programmatically switching off Android phone
You need the system key to sign your app. See this post for details;
How to compile Android Application with system permissions
Reference and original answer here
SOTI is a remote device administration system that offers a number of features.
One of them is the ability to execute scripts on Android phones remotely, provided that the SOTI client software is pre-installed and configured. The client program does not require a rooted device but it does act as a device administration.
One of the commands allowed in the SOTI scripting language is
wipeapplication com.example.notepad
This results in all of the app's (in this case a notepad) data being deleted, but not the actual APK file. So it gives you a clean slate for whatever application you specify. I understand that this could be done with root through the following:
rm -rf /data/data/com.example.notepad
But somehow SOTI is doing it without root. Just as an Android device administrator. Now the Android DeviceManagerPolicy class does have a wipe method, but its not application specific. Presumably, if there's a way to wipe the whole device at a certain permission level, there ought to be a way to wipe one app's data. But I haven't been able to find out which command is being used? How does SOTI do this?
To uninstall an Android application with bundle ID com.example.notepad , use the following script in Soti Mobicontrol:
uninstall com.example.notepad
We are developing an android application which is to be installed on the ~500 devices in the premises.How can I do it centrally at one go via wifi network.
Thrice every quarter, the following is required
The application (upgradeable version) needs to be installed.
Uninstalled (older version) frequently.
I know on device we can set "allow unknown sources" by default. But is it possible to push/install the application (like the ICS push on the Ginger Bread Mobile Phone recently)
I have gone through this post but no precise answer.
For the initial install, you can't. You have no choice but to manually install the app by one means or another (e.g., download it via a link from your intranet).
For updates, the app can check for an available update, download it, and then initiate an install when the user is ready. You cannot forcibly upgrade the app though -- the user will have to be involved.
You also cannot "installed (upgradable version)-uninstalled (older version)" except by hand -- once the app is uninstalled, it has no way to trigger installation of some other app. Also, by uninstalling, you lose all your data, which is generally frowned upon. Upgrading in place is the more typical approach.
Unless you have a custom version of Android on a device you cannot send an APK to the device and have it install automatically without using the Android Market.
However you can deploy applications to an individual device without user interaction using ADB . Using the following command:
adb install /Path/ToFile/ApkFile.apk
Additionally you can put the apk on the phone and then install it using the package manager.
It seems almost every android device comes without root permission, so some people provide a new ROM to root it. How do they achieve it? (Do they change anything in init process, or do they change some apps' access attributes on the storage, such as launcher or toolkit, or some process's uid/gid?)
I have a non-root mobile and another rooted one. I can't find the difference between them. The launcher are both with a uid/gid exceeding 10000.
In Linux desktop, this is controlled through the login process. But I still don't know the key reason.
It's confusing.
On a rooted Android, you can install apps that require special access (like the hardware)
Because the hardware manufacturers and the developers at Google did not want to let users tweak the hardware, the root user is blocked.
For example you can run softwares like Titanium backup (for making backups of application data), SetCPU (for overclocking your Android) and LES (Linux enhancement suite) if you have a rooted phone. Note that the rooted phone will allow apps to run through root only when asked for. Otherwise all the apps will work as the normal user.
In Linux, you can use the su command to get ALL the root permissions or sudo to get minimal root permissions (controlled su)
You can get the superuser permissions by rooting the phone, installing a terminal (Better Terminal Emulator) and typing "su" into the console. (Click "yes" if Superuser asks for permission)