Rajendar
Rajendar

Reputation: 209

Java.lang.SecurityException:SECURE PERMISSION in android?

Iam getting this error on my log

07-06 06:22:07.419: ERROR/AndroidRuntime(2618): java.lang.SecurityException: SECURE PERMISSION: Neither user 10070 nor current process has android.permission.WRITE_SECURE_SETTINGS.

I used like this

in activity file

private static final String SECURE_SETTINGS = android.Manifest.permission.WRITE_SECURE_SETTINGS;
mContext.enforceCallingOrSelfPermission(SECURE_SETTINGS,
        "BLUETOOTH_ADMIN permission");

in manifest file

<uses-permission android:name="android.permission.WRITE_SETTINGS" />  
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />

Why does it give error?

Upvotes: 0

Views: 6800

Answers (2)

anon
anon

Reputation:

You can only read this settings if your phone doesn't have root access. To enable bluetooth you can use this references http://developer.android.com/guide/topics/wireless/bluetooth.html.

However, this is above sdk5... I'm not really sure if it is a good idea to use bluetooth with sdk3. I also wanted to do an app which uses bluetooth and I had to switch my target level to above 2.0.1 because bluetooth below this sdk is not supported very well.

Upvotes: 0

Al Sutton
Al Sutton

Reputation: 3924

The WRITE_SECURE_SETTINGS permission is not available to apps which aren't part of the firmware because secure settings are designed to be secured against modification by third party apps.

Upvotes: 6

Related Questions