I think you should do the insert without the _id value (actually I
think it is uppercase "_ID").  The insert method returns a URI with
the new ID appended.  You can use that new URI in a call to the update
method that works just like the insert method.

On Jan 25, 1:55 am, Silent Warrior <[email protected]> wrote:
> Hi Murali,
>
> I was able to read and  add APN settings programetically using a
> content resolver as follows :
>
> NOTE : This code is written inside a "onCreate()" method of a class
> that extends an Activity.
>
> [CODE]
> ------------
> @Override
>         protected void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>
>                 //Trying to Insert a Custom Setting to Telephony db
>                 ContentValues values = new ContentValues();
>                 values.put("_id","3");
>                 values.put("name","Ramesh");
>                 values.put("numeric","310995");
>                 values.put("mcc","315");
>                 values.put("mnc","995");
>                 values.put("apn","email");
>                 values.put("user","elkjop");
>                 values.put("server","www.moota.com");
>                 values.put("password","elkjop");
>                 values.put("proxy","12");
>                 values.put("port","12");
>                 values.put("mmsproxy","12");
>                 values.put("mmsport","12");
>                 values.put("mmsc","12");
>                 values.put("type","a");
>                 values.put("current","a");
>
>                 //Adding Values using the Content Resolver
>                 getContentResolver().insert(Uri.parse("content://telephony/
> carriers"), values);
>
>                 Cursor cursor = 
> getContentResolver().(Uri.parse("content://telephony/
> carriers"),
>                                                                    null, 
> null, null, null);
>                 StringBuffer sb = new StringBuffer();
>
>                 cursor.moveToFirst();
>                 do{
>                 sb.append("_id =").append(cursor.getString(0)).append(" , ");
>                 sb.append("name=").append(cursor.getString(1)).append(" , ");
>                 sb.append("numeric=").append(cursor.getString(2)).append(" , 
> ");
>                 sb.append("mcc=").append(cursor.getString(3)).append(" , ");
>                 sb.append("mnc=").append(cursor.getString(4)).append(" , ");
>                 sb.append("apn=").append(cursor.getString(5)).append(" , ");
>                 sb.append("user=").append(cursor.getString(6)).append(" , ");
>                 sb.append("server=").append(cursor.getString(7)).append(" , 
> ");
>                 sb.append("password=").append(cursor.getString(8)).append(" , 
> ");
>                 sb.append("proxy=").append(cursor.getString(9)).append(" , ");
>                 sb.append("port=").append(cursor.getString(10)).append(" , ");
>                 sb.append("mmsproxy=").append(cursor.getString(11)).append(" 
> , ");
>                 sb.append("mmsport=").append(cursor.getString(12)).append(" , 
> ");
>                 sb.append("mmsc=").append(cursor.getString(13)).append(" , ");
>                 sb.append("type=").append(cursor.getString(14)).append(" , ");
>                 sb.append("current=").append(cursor.getString(15)).append(" , 
> ");
>
>                 sb.append("\n--- BLOCK ---\n");
>
>                 }while(cursor.moveToNext());
>
>                 Log.i(LOG_IDENTIFIER,sb.toString());
>
>                  startActivity(new Intent(Settings.ACTION_APN_SETTINGS));}
>
> ------------
> [/CODE]
>
> -- Now the Issue I have is how can I edit these settings ??. Any Ideas
> or help ??.
>
> Thanks,
> Ramesh.
>
> On Jan 22, 11:43 pm, Murali M <[email protected]> wrote:
>
> > I also have a same question as to how to programatically get/set/add EMAIL
> > and MMS settings. Currently i believe we have retrieve the information from
> > the db
>
> > Database: /data/data/com.android.providers.telephony/databases/telephony.db
> > Table: carriers
> > URI: content://telephony/carriers
>
> > Does anybody know if there is readily avaible APIs to  set EMAIL,MMS and
> > APNs
>
> > thanks,
> > Murali
>
> > On Fri, Jan 22, 2010 at 1:33 AM, Ramesh(BABY-FACE) <[email protected]>wrote:
>
> > > I was able to bring up the UI in android that allows the user to edit the
> > > APN settings. But I need to know how can I access these APN settings
> > > programmetically and set them. Any Ideas ?. Is this possible ??.
>
> > > - startActivity(new Intent(Settings.ACTION_APN_SETTINGS));
> > >  --
> > > *****************************************************
> > > M.Shehan Ramesh Perera
> > > Phone: +94 724787407
>
> > > *****************************************************
> > > Winston Churchill -- Success is Going From Failure To Failure Without
> > > Loosing Enthusiasm.
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> > > --
> > > 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]<android-developers%2Bunsubs
> > >  [email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en

-- 
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

Reply via email to