Hi All,

I was wondering if there was a specific way to use a specific APN for just 
certain HTTP calls for a regular marketplace App.
I found this:

*You can programmatically query and set the preferred APN using the uri 
content://telephony/carriers/preferapn. To set a new preferred APN you have 
to pass in the database ID of an existing APN entry. The following function 
can do this if you pass in the display name of the APN (eg: 
setPreferredApn(context, 
"Giffgaff");)
public static final Uri APN_TABLE_URI = Uri.parse(
"content://telephony/carriers");
public static final Uri APN_PREFER_URI = Uri.parse(
"content://telephony/carriers/preferapn");
 public static boolean setPreferredApn(Context context, String name) {
 boolean changed = false;
 String columns[] = new String[] { Carriers._ID, Carriers.NAME };
 String where = "name = ?";
 String wargs[] = new String[] {name};
 String sortOrder = null;
 Cursor cur = context.getContentResolver().query(APN_TABLE_URI, columns, 
where, wargs, sortOrder);
 if (cur != null) {
 if (cur.moveToFirst()) {
 ContentValues values = new ContentValues(1); values
values.put("apn_id", cur.getLong(0));
 if (context.getContentResolver().update(APN_PREFER_URI, values, null, null) 
== 1) changed
 changed = true;
 } cur
cur.close();
 }
 return changed;
}
I guess I should add that you need WRITE_APN_SETTINGS permission and need 
to import android.provider.Telephony and android.provider.Telephony.Carriers
*

But even if this works it looks like it sets it for the whole device. I 
just want to use a specific APN for a specific HTTP call or even for my app 
only. Not for the whole device.

Is this possible with the SDK as a regular app? And can this be 
accomplished if my app is a System App instead?

Thanks,
--Edmund 

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