SmsManager smsManager = SmsManager.getDefault(); 是否被弃用

                                                           Android之SmsManager是否被弃用了

问题描述

    SmsManager smsManager = SmsManager.getDefault(); 猜想,SmsManager是不是被废弃了

问题解决

     Android提供了两个SmsManager类,gsm包下的是被废弃的,

     而,android.telephony.SmsManager包是当下正在使用的。
  

   所以你是导错包了!

private void confirmSendMessageIfNeeded(int subscription) { 1253 if (isLTEOnlyMode(subscription)) { 1254 showDisableLTEOnlyDialog(subscription); 1255 return; 1256 } 1257 boolean isMms = mWorkingMessage.requiresMms(); 1258 if (!isRecipientsEditorVisible()) { 1259 if (isMmsWithMobileDataOff(isMms, subscription)) { 1260 showMobileDataDisabledDialog(subscription); 1261 } else { 1262 sendMsimMessage(true, subscription); 1263 } 1264 return; 1265 } 1266 1267 if (mRecipientsEditor.hasInvalidRecipient(isMms)) { 1268 showInvalidRecipientDialog(subscription); 1269 } else if (isMmsWithMobileDataOff(isMms, subscription)) { 1270 showMobileDataDisabledDialog(subscription); 1271 } else { 1272 if (!TextUtils.isEmpty(getString(R.string.mms_recipient_Limit)) 1273 && isMms 1274 && checkForMmsRecipients(getString(R.string.mms_recipient_Limit), true)) { 1275 return; 1276 } 1277 // The recipients editor is still open. Make sure we use what's showing there 1278 // as the destination. 1279 ContactList contacts = mRecipientsEditor.constructContactsFromInput(false); 1280 mDebugRecipients = contacts.serialize(); 1281 sendMsimMessage(true, subscription); 1282 } 1283 } 1284 1285 private void confirmSendMessageIfNeeded() { 1286 TelephonyManager tm = (TelephonyManager)getSystemService( 1287 Context.TELEPHONY_SERVICE); 1288 boolean isMultiSim = TelephonyManagerWrapper.isMultiSimEnabled(tm); 1289 int slot = SubscriptionManagerWrapper.getSlotId( 1290 SmsManager.getDefault().getDefaultSmsSubscriptionId()); 1291 if ((isMultiSim && isLTEOnlyMode(slot)) 1292 || (!isMultiSim && isLTEOnlyMode())) { 1293 showDisableLTEOnlyDialog(slot); 1294 LogTag.debugD("return for disable LTEOnly"); 1295 return; 1296 } 1297 1298 boolean isMms = mWorkingMessage.requiresMms(); 1299 int defaultSubId = SubscriptionManager.getDefaultSmsSubscriptionId(); 1300 if (!isRecipientsEditorVisible()) { 1301 if (isMultiSim) { 1302 if ((tm.getPhoneCount()) > 1 && 1303 MessageUtils.isMsimIccCardActive()) { 1304 if(MessageUtils.isSMSPromptEnabled(ComposeMessageActivity.this)) { 1305 launchMsimDialog(true, isMms); 1306 } else { 1307 sendMsimMessageNotPrompt(true, isMms, defaultSubId); 1308 } 1309 } else { 1310 sendMsimMessageNotPrompt(true, isMms, defaultSubId); 1311 } 1312 } else if (isMmsWithMobileDataOff(isMms, defaultSubId)) { 1313 showMobileDataDisabledDialog(); 1314 } else { 1315 sendMessage(true); 1316 } 1317 return; 1318 } 1319 1320 if (mRecipientsEditor.hasInvalidRecipient(isMms)) { 1321 showInvalidRecipientDialog(); 1322 } else if (TelephonyManager.getDefault().isMultiSimEnabled()) { 1323 if ((tm.getPhoneCount()) > 1 && 1324 MessageUtils.isMsimIccCardActive()) { 1325 if(MessageUtils.isSMSPromptEnabled(ComposeMessageActivity.this)) { 1326 launchMsimDialog(true, isMms); 1327 } else { 1328 sendMsimMessageNotPrompt(true, isMms, defaultSubId); 1329 } 1330 } else { 1331 sendMsimMessageNotPrompt(true, isMms, defaultSubId); 1332 } 1333 } else if (isMmsWithMobileDataOff(isMms, defaultSubId)) { 1334 showMobileDataDisabledDialog(defaultSubId); 1335 } else { 1336 if (!TextUtils.isEmpty(getString(R.string.mms_recipient_Limit)) 1337 && isMms 1338 && checkForMmsRecipients(getString(R.string.mms_recipient_Limit), true)) { 1339 return; 1340 } 1341 // The recipients editor is still open. Make sure we use what's showing there 1342 // as the destination. 1343 ContactList contacts = mRecipientsEditor.constructContactsFromInput(false); 1344 mDebugRecipients = contacts.serialize(); 1345 sendMessage(true); 1346 } 1347 }给这段代码添加注释
08-24
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值