I am trying to set a preferred APN through code. Here's what I'm doing:
** 
*private static* *final* Uri *PREFERRED_CONTENT_URI* = Uri.*parse*(
"content://telephony/carriers/preferapn");

 

// getCurrentPreferredAPN is an internal function to retrieve the "_id" of 
the current APN.
String strCurrent = getCurrentPreferredAPN();

ContentValues values =  *new* ContentValues();

Uri ret;

// create the dummy ID

values.put(*SZ_NAME*, *"blah"*);values.put(*SZ_APN*, *"blah"*);

values.put(*SZ_TYPE*, *"blah"*);

values.put("current", "1");

 

// 'delete' the current entry.
nUpdated = getContentResolver().delete(PREFERRED_CONTENT_URI, "_id=?", new 
String[] 
{ strCurrent };

// 'insert' a new entry.
ret = getContentResolver().insert(PREFERRED_*CONTENT_URI*, values);*if*(*
null* == ret)

{

Log.*i*("Add Dummy APN", "Failed");

*return*;

}

 

The call   ==> "insert"* ==>*  is always returning null for me.

 

What is the right way of doing this?

 

 

** 

 

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to