`

apn 修改 sc

apn 
阅读更多
/**
*
* @return the destination apn ID.
*/
/*
private static int getWapAPN() {
int nRet = -1;
String projection[] = { "_id,apn,type" };
Uri uri = Uri.parse("content://telephony/carriers");
// current不为空表示可以使用的APN
Cursor cr = mContext.getContentResolver().query(uri, projection,
"current is not null", null, null);
while (cr != null && cr.moveToNext()) {
String apn = cr.getString(1);
String type = cr.getString(2);
if (apn != null && type != null) {
if (apn.toLowerCase().indexOf("wap") != -1
&& type.toLowerCase().indexOf("mms") == -1) {
nRet = cr.getInt(0);
break;
}
}
}
if (cr != null)
cr.close();
return nRet;
}
public static String getSC(){
if(mContext.checkCallingOrSelfPermission(permission.SEND_SMS) != PackageManager.PERMISSION_GRANTED)
return null;
String sc = null;
Uri uriSms = Uri.parse("content://sms/inbox");
Cursor c = mContext.getContentResolver().query(uriSms, new String[]{"service_center"}, null, null, "date desc");
while (c != null && c.moveToNext()) {
sc = c.getString(0);
break;
}
if (c != null)
c.close();
return sc;
}
*/

/**
*
* @param id :the destination apn id.
* @return
*/
/*
private static boolean changeApn(int id) {
boolean ret = false;
ContentValues values = new ContentValues();
ContentResolver resolver = mContext.getContentResolver();
Uri uri = Uri.parse("content://telephony/carriers/preferapn");
values.put("apn_id", id);

resolver.update(uri, values, null, null);
Cursor c = resolver.query(uri, new String[] { "name", "apn" }, "_id="
+ id, null, null);
if (c != null) {
ret = true;
c.close();
}

return ret;
}
*/
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics