Is there a way to set the default APN through code?
I'm trying with this snippet:
String id = null;
Uri contentUri =
Uri.parse("content://telephony/carriers/
preferapn");
Cursor cursor = null;
ContentResolver resolver = getContentResolver();
try {
cursor = resolver.query(contentUri, new
String[]{"_id"}, null,
null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
id = cursor.getString(0);
System.out.println("Found APN with id: " +
id);
}
}
} catch (Exception ex){
//Handle exceptions here
} finally {
if (cursor != null) cursor.close();
}
if(id != null){
ContentValues values = new ContentValues();
values.put(id, "new apn value"); //does this works?
resolver.update(contentUri, values, null, null);
}
However, once it is done, if we read again the default APN it remains
unchanged. I'm testing this on sdk 1.5.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---