Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ina · Oct 18, 2011 at 02:43 AM · androidiosmobilesms

Is it possible to send SMS from an action in Unity? (Mobile iOS or Android)

Is it possible to send SMS whether from the external SMS app or another process, via Unity? - on an iOS or Android mobile device

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

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);
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DVFrance · Aug 20, 2016 at 03:33 PM 0
Share

I add something here : http://answers.unity3d.com/questions/244599/how-to-send-sms-in-unity-android-game.html

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to use Application.OpenUrl("sms") for multiple numbers? 2 Answers

Is it possible to send an SMS without opening SMS Composer? (Android) 3 Answers

Unity 5 mobile single stick control 6 Answers

Is GameObject.FindWithTag Bad for Mobile Platforming? 1 Answer

Mobile game laggy? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges