2014-03-25 2 views
3

SMS를 보내는 Android 앱을 개발하려고합니다. 내가 그들을 감지하고 SMS를 감사를 보내 특정 SIM 카드를 선택하는 방법을 두 가지 SIM (SIM1, SIM2) 카드,듀얼 폰의 특정 SIM 카드에서 SMS를 보내는 방법

+1

가능한 중복 (http://stackoverflow.com/questions/5255147/dual-sim-card-android) –

+1

봐 http://stackoverflow.com/ 질문/5255147/dual-sim-card-android) 및 [여기] (http://stackoverflow.com/questions/19557147/send-sms-with-second-sim-card-by-android-on-samsung-duos) –

답변

-1

는 MTK 플랫폼에서 사용할 수있는 경우 :) (

SmsManagerEx.getDefault .sendTextMessage (serverAddress, null, textMessage, pendingIntent, null, mSIM);

1

이 코드를 사용해보십시오. Android sdk 5.1 이상을 사용합니다.

String SENT = "SMS_SENT"; 
String DELIVERED = "SMS_DELIVERED"; 

PendingIntent localPendingIntent1 = PendingIntent.getBroadcast(mContext, 0, new Intent(this.SENT), 0); 
PendingIntent localPendingIntent2 = PendingIntent.getBroadcast(mContext, 0, new Intent(this.DELIVERED), 0); 

SubscriptionManager localSubscriptionManager = SubscriptionManager.from(mContext); 
if (localSubscriptionManager.getActiveSubscriptionInfoCount() > 1) 
{ 
List localList = localSubscriptionManager.getActiveSubscriptionInfoList(); 
final String[] arrayOfString = new String[localList.size()]; 
int i = 0; 
Iterator localIterator = localList.iterator(); 
while (localIterator.hasNext()) 
{ 
SubscriptionInfo localSubscriptionInfo = (SubscriptionInfo)localIterator.next(); 
localSubscriptionInfo.getSubscriptionId(); 
//log.d("22 api level ", "got dual sim: "); 
int j = i + 1; 
arrayOfString[i] = (localSubscriptionInfo.getCarrierName().toString() + " " + localSubscriptionInfo.getNumber()); 
i = j; 
} 

SmsManager.getDefault().sendTextMessage(paramString1, null, paramString2, localPendingIntent1, localPendingIntent2); 
[여기] ([듀얼 SIM 카드 안드로이드]의
+0

이 링크도 참조하십시오 .http : //stackoverflow.com/questions/38093754/send-sms-using-sim-selection-option# – harikrishnan

+0

질문은 ** 특정 SIM에서 SMS를 보내는 방법 **을 묻습니다. 특정 SIM에 대한 정보를 얻으십시오! – Choletski

관련 문제