Reputation: 517
first of all thanks for the great community out there! I try to implement this Phonegap SMS Plugin:
https://github.com/asanka-x/Phonegap-SMS
I ve got problems with the implementation of the source code. I ve copied all files to the places and now I ve got no clue how to implement this within my html file?
SmsPlugin.send = function (phone, message, method, successCallback, failureCallback) { ... } ? SmsPlugin.startReception = function(successCallback,failureCallback) { ... } ? SmsPlugin.prototype.stopReception = function(successCallback,failureCallback) { ... } ?
Is this Plugin supporting Android and PhonegapVersion 3.3? Couldn´t find information providing this.
I ve also contacted the author but no reply till yet so I decided to open this thread (there is none fitting to this till yet)
I hope you guys can help me! Thanks so far! :)
Upvotes: 1
Views: 1164
Reputation: 315
I have been using this plugin to send SMS messages for and Android app, so yes it supports Android... You should add this functions in your html file within javascript tag. Here is an example to use:
<p><button class="send-sms">Send SMS asanka</button></p>
<script type="text/javascript>
$('.send-sms').on('click', function() {
var number = "<change with the number you want to send sms to>";
var message = "TEST BODY";
var smsplugin = cordova.require("info.asankan.phonegap.smsplugin.smsplugin");
var success = function () { alert('sent '); };
var error = function (e) { alert('failed:' + e); };
smsplugin.send(number,message,success,error);
});
</script>
Just add above part to between the body tag in your index.html
, you would be able to send SMS to the number defined in number
variable. Message body defined in the message
variable, when you click to the button named Send SMS asanka
.
Upvotes: 1
Reputation: 2490
For version infos check this: https://build.phonegap.com/plugins/368 > running on 3.3!
SmsPlugin.send: -> Function to send sms
SmsPlugin.startReception -> Start receiving sms, and the successCallback function receives one string as parameter formatted such as [phonenumber]>[message] (this is from the inline doc)
SmsPlugin.stopReception -> Stop receiving sms
Upvotes: 0