Sending an SMS Text Message
Monkey Targets Forums/Android/Sending an SMS Text Message
| ||
This is how to Send a Text from your android phone: This is the android file: rophone.android.java import android.telephony.SmsManager; class rophone { public static SmsManager SmsM = SmsManager.getDefault(); static void SendSms(String number, String msg) { SmsM.sendTextMessage(number, null, msg, null, null); } } This is the monkey script: rophone.monkey #If TARGET = "android" Import mojo Import "rophone.android.java" Extern Function SendSms:Void(number:String, msg:String) = "rophone.SendSms" Public #Endif Here's how to use it: SendSms("5554748392", "Text")'That's not a real number... Tested and works. Make sure to add the "SEND_SMS" permission to the AndroidManifest. I plan on making a small phone library. |
| ||
That's cool, thanks! |
| ||
nice |
| ||
very easy to implement and works great thanks for this. |
| ||
Thanks for the positive feedback XD I hope someone can use it |
| ||
hehe just built a spamming app.Right now to spamtext my enemies |
| ||
Awesome! I did the exact same thing haha XD |
| ||
Nice! |
| ||
thank you! I will use this for my current online-game. Now the user can invite friends for playing with him and sending them the Team-Id. What about writing a list of all possible native android function calls here in forum? |
| ||
What about writing a list of all possible native android function calls here in forum? Here you go: http://developer.android.com/reference/packages.html ;) |
| ||
do you think all these functions could be integrated? wow! |
| ||
Yes, with enough time and writing the externs, why not :-) |
| ||
yeah the externs are pretty awesome. Here's another use which the code is nearly the same. It detects the Language that your android device is set too. android file: extra.android.java import java.util.Locale; class roExtra { public static Locale Loc = Locale.getDefault(); public static String GetLang() { return Loc.getDisplayLanguage(); } } and here's the Android file: #If TARGET = "android" Import "extra.android.java" Extern Function GetLang:String() = "roExtra.GetLang" Public #Else Function GetLang:String() Return "" End function #Endif It should return a string with the language |
| ||
Looks like it's only allowed for one app to send SMS in Android 4.4 "Given the fact that on Android 4.4 KitKat, only one application will be able to receive and send SMS / MMS, Google recommends devs to disable the ability to send new messages when a certain app is not currently selected as default. " http://news.softpedia.com/news/Google-Details-SMS-Changes-in-Android-4-4-KitKat-Offers-New-APIs-391108.shtml |