Read and write access was available to all applications through Android 2.x. Android 4.0 and 4.1 required system access for the WRITE permission but not for READ, and Android 4.2+ required system access for both READ and WRITE.
On Tue, May 14, 2013 at 9:13 AM, Jindřich Matouš < [email protected]> wrote: > > 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 [email protected]. > To post to this group, send email to > [email protected]. > 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. > > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/android-security-discuss. For more options, visit https://groups.google.com/d/optout.
