2017-11-20 2 views
-1

어떻게 UPI android 앱이 sim 연산자 이름을 얻고 선택한 시뮬레이션을 사용하여 메시지를 보냅니 까?UPI처럼 앱을 만드는 방법은 무엇입니까?

이동 통신사 이름을 얻으려면 Subscription Manager를 사용하고 있습니다. 내 코드 점점 캐리어 이름은

List<SubscriptionInfo> subscriptionInfos = SubscriptionManager.from(context).getActiveSubscriptionInfoList(); 

for (int i = 0; i < subscriptionInfos.size(); i++) 
{ 
    carrierNames.add(subscriptionInfos.get(i).getCarrierName().toString()); 
    subscriptionId.add(subscriptionInfos.get(i).getSubscriptionId()); 
} 

답변

0

, 당신은 이런 일을 할 수있는 SMS를 보내는

TelephonyManager telephonyManager= (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); 
String carrierName = telephonyManager.getNetworkOperatorName(); 

을 시도입니다 :

PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, 
new Intent(this, class), 0);     
SmsManager smsManager = SmsManager.getDefault(); 
smsManager.sendTextMessage(phoneNumber, null, " <your message>", pendingIntent, null); 
+0

하지만 어떻게 내 서버가 메시지를 보낼 수에 대해 알고있다. – Mazid

+0

앱이 SMS를 보내고 사용자의 전화 번호를 서버에 저장하려는 경우 HttpClient 클래스를 사용하여 앱에서 서버로 전송합니다. –

관련 문제