Hallo Collegue,
I want to change current APN by following code:
And this error raised.
In manifest already filled:
<uses-permission *android:name="android.permission.WRITE_APN_SETTINGS"*/>
 
java.lang.SecurityException: No permission to write APN settings: Neither 
user 10051 nor current process has android.permission.WRITE_APN_SETTINGS.
It is protected by system? Haw can I change it?
 

 public static boolean setActiveAPN(Context context, int id) throws 
IllegalArgumentException {
  boolean res = false;
  ContentResolver resolver = context.getContentResolver();
  ContentValues values = new ContentValues();

  values.put("apn_id", id);
  try {
   resolver.update(PREFERRED_APN_URI, values, null, null);
   Cursor c = resolver.query(PREFERRED_APN_URI, new String[] { "name", 
"apn" }, "_id=" + id, null, null);
   if (c != null) {
    res = true;
    c.close();
   }
  } catch (SQLException e) {
   Log.d(TAG, e.getMessage());
   throw new IllegalArgumentException("APN cannot be set! (probably wrong 
name");
  }
  return res;
 }

-- 
You received this message because you are subscribed to the Google Groups 
"Android Security Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-security-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to android-security-discuss@googlegroups.com.
Visit this group at 
http://groups.google.com/group/android-security-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to