android 如何设置小区广播默认信道 主要是印度市场
要求设置默认信道50与60,并支持双卡。在PhoneApp.java文件中增加code:
在文件开头部分import 包:
import android.provider.Telephony;
import com.android.internal.telephony.gsm.SmsBroadcastConfigInfo;
import android.content.ContentValues;
import android.database.Cursor;
2.在文件开头部分增加变量:
private final BroadcastReceiver mSmsReadyReceiver = new SmsReadyBroadcastReceiver();
private static final int MESSAGE_SET_STATE = 33;
private static final int MESSAGE_SET_CONFIG = 32;
private static final String KEYID = "_id";
private static final String NAME = "name";
private static final String NUMBER = "number";
private static final String ENABLE = "enable";
private static final Uri CHANNEL_URI = Uri.parse("content://cb/channel");
private static final Uri CHANNEL_URI1 = Uri.parse("content://cb/channel1");
3.在mHandeler中增加Case:
case MESSAGE_SET_STATE:
handleSetStateResponse(msg);
break;
4.在oncreate函数中注册cellbroadcastRecivier:
IntentFilter smsReadyIntentFilter = new IntentFilter("android.provider.Telephony.SMS_STATE_CHANGED");
registerReceiver(mSmsReadyReceiver,smsReadyIntentFilter);
5.在类中增加函数:
private class SmsReadyBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent){
Log.e("kpp","Sms Ready!!");
String action = intent.getAction();
Log.e("kpp","Sms Ready action ="+action);
if (action.equals("android.provider.Telephony.SMS_STATE_CHANGED")) {
int extra = intent.getIntExtra("simId",0);
boolean isReady = intent.getBooleanExtra("ready",false);
Log.e("kpp","Sms Ready extra ="+extra);
Log.e("kpp","Sms Ready isReady ="+isReady);
if(!isReady){
return;
}
Message msg;
msg = mHandler.obtainMessage(MESSAGE_SET_STATE, extra, MESSAGE_SET_STATE,null);
&n
补充:移动开发 , Android ,