- Home /
Answer by hoanhunguyen · Mar 01, 2012 at 08:27 AM
I am new to Unity 3d and my English is not very good. I am still having the same problem that you see described above. I want to write an application to send a message to the Mobile IOS. After some research I found Java code:
 private void sendSMS(String phoneNumber, String message){        
 String SENT = "SMS_SENT";
 String DELIVERED = "SMS_DELIVERED";
 PendingIntent sentPI = PendingIntent.getBroadcast(SMS.this, 0, new Intent(SENT), 0);
 PendingIntent deliveredPI = PendingIntent.getBroadcast(SMS.this, 0, new Intent(DELIVERED), 0);
 //---when the SMS has been sent---
 registerReceiver(new BroadcastReceiver(){
     @Override
     public void onReceive(Context arg0, Intent arg1) {
         switch (getResultCode())
         {
             case Activity.RESULT_OK:
                 Toast.makeText(getBaseContext(), "SMS sent",     Toast.LENGTH_SHORT).show();
                 break;
             case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                 Toast.makeText(getBaseContext(), "Generic failure", 
                         Toast.LENGTH_SHORT).show();
                 break;
             case SmsManager.RESULT_ERROR_NO_SERVICE:
                 Toast.makeText(getBaseContext(), "No service", 
                         Toast.LENGTH_SHORT).show();
                 break;
             case SmsManager.RESULT_ERROR_NULL_PDU:
                 Toast.makeText(getBaseContext(), "Null PDU", 
                         Toast.LENGTH_SHORT).show();
                 break;
             case SmsManager.RESULT_ERROR_RADIO_OFF:
                 Toast.makeText(getBaseContext(), "Radio off", 
                         Toast.LENGTH_SHORT).show();
                 break;
         }
     }
 }, new IntentFilter(SENT));
 //---when the SMS has been delivered---
 registerReceiver(new BroadcastReceiver(){
     @Override
     public void onReceive(Context arg0, Intent arg1) {
         switch (getResultCode())
         {
             case Activity.RESULT_OK:
                 Toast.makeText(getBaseContext(), "SMS delivered", 
                         Toast.LENGTH_SHORT).show();
                 break;
             case Activity.RESULT_CANCELED:
                 Toast.makeText(getBaseContext(), "SMS not delivered", 
                         Toast.LENGTH_SHORT).show();
                 break;                        
         }
     }
 }, new IntentFilter(DELIVERED));        
 SmsManager sms = SmsManager.getDefault();
 sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);        
}
Can anyone help with this problem on IOS?
Thanks
hoanhunguyen
Answer by Chowdery · Aug 04, 2013 at 09:51 AM
Hey Guys, I was scrounging around for an answer to this functionality as well and managed to find the below code that opens up the phone SMS window with a list of recipients to send the SMS to.
 string mobile = "0437614201";
 Application.OpenURL("sms:" + mobile);
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                