How to run an apk with UID root

by ksk » Mon, 22 Feb 2010 06:36:44 GMT

Sponsored Links

          I have an application(apk) which normally gets uid as
app_16. Internally it calls a Shared library, which tries to write to
HCI socket(bluetooth socket). Here the socket which is created has
bluetooth UID and GID. It is not allowing to write to that socket.

Can any body give me suggestion what all permissions should be given
in manifest file to make it work. I have bluetooth and bluetooth admin
in Manifest file.

or Any thing should be added to framework such that my apk and library
gets permissions to aceeses HCI socket.


How to run an apk with UID root

by Dianne Hackborn » Mon, 22 Feb 2010 20:09:32 GMT

 Sorry, no .apk can run as root.  The android system is designed carefully to
run very few things as root, and that is way lower level than an .apk.  Not
even the system process (hosting the package manager, activity manager,
window manager, and various other essential system services) runs as root or
can cause something else to run as root.

Typically how device access is handled is by defining a uid that the device
is a group of and a permission in permissions.xml mapping to that uid, so an
.apk can use <uses-permission> to be included in that uid group.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

Sponsored Links

Other Threads

1. Problem in SimpleDateFormat MMM return month number

The problem is when you do not care what locale are set and simply
want to use system-wide, not any particular one.
Calling setDefault is same like passing locale to SimpleDateFormater
constructor - you need to either specify locale or read system
settings and pass that in hope it works. Since this is like blind fix
it may or may not work but you still do not know what the culprit is.


2. Android Market strips "Move to SD card" attribute -- what am I doing wrong?

Hi guys -- I have an app which I'd like people to be able to install
onto the SD card through Settings->Applications->Manage applications.

I now have a .apk file that if I install it directly, does allow me to
do the above, but when I submit it to Android Market and then install
from there, it doesn't (the option's greyed out for me, and it is for
others too).

Any idea what I need to do differently? I guess Market is rebuilding
the apk and losing the XML attribute along the way, but I can't see

Here's my manifest file, which looks fine to me -- so I'm at a loss.
My eclipse project target SDK version is set to 8 (so that it
understands the new attribute), and android:minSdkVersion is set to 3
(as it always has been) -- which is my understanding of how the
android docs say I should do this :-(

Thanks in advance,



<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
      android:versionName="2.14" package="com.wheadon.photoenhancepro"
    <uses-sdk android:minSdkVersion="3" />
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <application android:icon="@drawable/icon" android:label="@string/
    android:debuggable="false" >
        <activity android:name=".PhotoEnhance"
                <action android:name="android.intent.action.MAIN" />
android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.intent.action.SEND"/>
                <data android:mimeType="image/jpeg" />
    <activity android:name=".Preferences" android:label="@string/
    <activity android:name=".Crop" android:label="@string/crop"></


3. A general purpose development phone

4. Database handling - when do you open and close

5. Hey my friend,

6. Salam perkenalan dari yang baru join.

7. AutoMMS code