2013-10-25 4 views
1

나는 을 사용하여 다른 번호로 SMS를 보내야하지만, donot은 전화 네이티브 api 즉 smsManage r을 사용하고 싶지 않습니다. 이동 통신 사업자에게 SMS를 지불하는 것을 의미합니다. Internet을 사용하여 twillonexmo을 보내고 싶지만 iam이 안드로이드 앱에서이 API를 사용할 수 없습니다. 내 안드로이드에서이 API를 사용하는 iam이 응용 프로그램이 충돌하면 api가 있으면 제게 제안하십시오. 또는 기타 참조는 internet을 통해 SMS를 보낼 수 있습니다. 또는 당신이 찾고있는 용어는 SMS gateway입니다 webservices어떤 api가 인터넷을 통해 안드로이드를 통해 sms를 보낼 수 있습니까?

+0

의 중복 가능성 [프로그래밍 SMS (http://stackoverflow.com/questions/4269/programmatic-sms) –

답변

2

를 사용하여 .. Twilio API는 안드로이드와 함께 잘 작동, 또는 당신이 당신의 소원에 따라 다른 사용할 수 있습니다 .. 가장

Bulk SMS입니다. Register here

예 예와 같이 다음 사용자 이름과 암호를 사용

import java.net.*; 
import java.io.*; 

public class SendSms { 

static public void main(String[] args) { 
    try { 
     // Construct data 
     String data = ""; 
     data += "username=" + URLEncoder.encode("your username", "ISO-8859-1"); 
     data += "&password=" + URLEncoder.encode("password", "ISO-8859-1"); 
     data += "&message=" + URLEncoder.encode("your message", "ISO-8859-1"); 
     data += "&want_report=1"; 
     data += "&msisdn=44123123123";// relace with the number 

     // Send data 
     URL url = new URL("http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0"); 

     URLConnection conn = url.openConnection(); 
     conn.setDoOutput(true); 
     OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); 
     wr.write(data); 
     wr.flush(); 

     // Get the response 
     BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); 
     String line; 
     while ((line = rd.readLine()) != null) { 
      // Print the response output... 
      System.out.println(line); 
     } 
     wr.close(); 
     rd.close(); 
    } catch (Exception e) { 
     e.printStackTrace(); 
    } 
} 
} 
+0

그 샘플 프로그램에 대한 자습서가 있습니까? android에서 twilio를 통해 SMS를 보내십시오. – user2918549

+0

twilio에서 다운로드 할 수 있습니다. 그들은 자바 API를 제공합니다. 당신은 그것을 사용할 수 있습니다 –

+1

자바 API와 함께 사용했지만 응용 프로그램이 깨졌습니다 – user2918549

관련 문제