This is a migrated thread and some comments may be shown as answers.

SMS plug-in

30 Answers 287 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Павел
Top achievements
Rank 1
Павел asked on 12 Aug 2012, 12:46 PM
Is here any ways to get SMS functions of Android?

30 Answers, 1 is accepted

Sort by
0
sdobrev
Top achievements
Rank 1
answered on 14 Aug 2012, 06:54 AM
Hi Павка,

SMS for Android can be achieved via this PhoneGap plugin. Plugins are the current most requested feature on our feedback portal and they are very high in our backlog.

Hope this helps.
0
Benjamin
Top achievements
Rank 1
answered on 03 Dec 2012, 01:57 PM
Hi, I just want to know, how I must include this plug-in in Icenium ? What are the main steps ?
0
Stefan Dobrev
Telerik team
answered on 04 Dec 2012, 08:20 AM
Hi Benjamin,

This plugin is not supported in Icenium yet. What you can do is to go to our feedback portal and vote for it so we can prioritize it in our backlog according to the votes its get. 

-sdobrev

Share feedback and vote for features on our Feedback Portal.
Want some Kendo UI online training - head over to Pluralsight.
0
Steve
Telerik team
answered on 05 Jul 2013, 04:43 PM
Hi guys,

This is just a follow up in case you have missed the Icenium 1.6 release, where we've added the ability to add Plugman-compatible Apache Cordova plugins to your Icenium project. For more information, see Working with Custom Plugins help article.

If it is not compatible, you would have to make the necessary modifications in order to be able to use it, see Requirements for Custom Apache Cordova Plugins and Plugman specifications.

For the full list of shiny goodies that made it in the 1.6 release, please refer to the Icenium 1.6 Release Notes.

Regards,
Steve
Telerik

Looking for tips & tricks directly from the Icenium team? Check out our blog!
Missed our first webinar, watch it here.
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 13 Sep 2013, 10:09 PM
Is there any example app with this SMS plug-in? My problem is: when I run my application, it says window.plugins.sms is undefiened, though I followed settiings like the pushnotification plugin-in.
0
Steve
Telerik team
answered on 18 Sep 2013, 02:06 PM
Hello Nahid,

The plugin from the link my colleague has posted is compatible with 1.5.0 version of Cordova, which is not supported in Icenium. We have found a newer 2.7.0 compatible SmsPlugin. Before using it you should make it plugman compatible. More information could be found here.

We have attached a sample project that seems to be working. We have hard coded the number and the text message so feel free to modify them appropriately.

Regards,
Steve
Telerik

Big news for mobile app and .NET developers! Hear about it at our Release Keynote. Thursday, September 26th, 11AM EDT
Do you enjoy Icenium? Vote for it in Windows IT Pro Community Choice Awards as Best Cloud Computing Product or Service (Category 5).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 19 Sep 2013, 04:35 AM
Hi Steve,
Many thanks for your help. I downloaded your sample project, and could run it without changing anything. Now my another question is: if I try to modify the plugin.xml of any plugins, the plugin doesn't work at all. Suppose if I want to add option for ios, which way I should modify the plugin.xml file.  Is there any online software what can validate the plugin.xml for plugman? When I modify a plugin.xml file, I cannot compile the code anymore. Though I check the plugman specification when I modify the plugin.xml.

Thanks in advace.

Nahid
0
Stefan Dobrev
Telerik team
answered on 20 Sep 2013, 02:48 PM
Hello Nahid,

Can you please paste the contents of your plugin.xml here in the forum thread? We will look into and point you to any issues we find out. You can also send us the error you are getting back from Icenium.

 

Regards,
Stefan Dobrev
Telerik

Big news for mobile app and .NET developers! Hear about it at our Release Keynote. Thursday, September 26th, 11AM EDT
Do you enjoy Icenium? Vote for it in Windows IT Pro Community Choice Awards as Best Cloud Computing Product or Service (Category 5).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nahid
Top achievements
Rank 1
answered on 20 Sep 2013, 04:47 PM
Hi Stefan,
Actually I need an application which can send sms to both android and ios. SmsPluglin only works for android, so I tried to add SMSComposer plugin with SmsPlugin. At first I  used smsplugin.js and SMSComposer.js file separately. Later I moved functionality  from SMSComposer.js to smsplugin.js to use only one js file call. I created a folder ios beside android and copied SMSComposer .h and .m files. 

Below is the copy of plugin.xml when I used smsplugin.js and SMSComposer.js file separately. Many thanks for your kind help.

Regards,

Nahid


<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0" id="com.phonegap.plugins.smsplugin"
version="0.1.0">   

<!-- android -->
<platform name="android">
     <asset src="www/smsplugin.js" target="Plugins/SMSPlugin/smsplugin.js" />
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.SEND_SMS" />
</config-file>
<config-file target="res/xml/plugins.xml" parent="/plugins">
<plugin name="SmsPlugin"
value="com.phonegap.plugins.smsplugin.SmsPlugin"/>
</config-file>
<config-file target="res/xml/config.xml" parent="plugins">
<plugin name="SmsPlugin"
value="com.phonegap.plugins.smsplugin.SmsPlugin"/>
</config-file>

<source-file src="src/android/SmsPlugin.java" target-dir="src/com/phonegap/plugins/smsplugin" />
</platform>
<!-- ios -->
    <platform name="ios">
    <asset src="www/SMSComposer.js" target="Plugins/SMSPlugin/SMSComposer.js" /> 

    <plugins-plist key="SMSComposer" string="SMSComposer" />
<config-file target="res/xml/plugins.xml" parent="/plugins">
        <feature name="SMSComposer">
                <param name="ios-package" value="com.phonegap.plugins.smsplugin.SMSComposer"/>
                <param name="onload" value="true" />
            </feature>
        </config-file>    
     <source-file src="src/android/SMSComposer.h"/>
     <source-file src="src/android/SMSComposer.m"/>   
    </platform>
</plugin>

0
Stefan Dobrev
Telerik team
answered on 25 Sep 2013, 03:47 PM
Hello Nahid,

It seems that the values you have used for iOS in the plugin.xml are incorrect. For example the value of the ios-package parameter under feature should be the name of the native class in Objective-C - SMSComposer. For header files you should use the header-file element, not source-file. Also it would be better if iOS source files are in directory named ios, not android. Plugins-plist element is also not necessary, because it is a legacy one for old Cordova versions. Here you can find an example of a plugin.xml configuration for iOS.

As a side note will an SMS URL scheme link work for your case. Here is a blog post that illustrates its usage.
 

Regards,
Stefan Dobrev
Telerik

Big news for mobile app and .NET developers! Hear about it at our Release Keynote. Thursday, September 26th, 11AM EDT
Do you enjoy Icenium? Vote for it in Windows IT Pro Community Choice Awards as Best Cloud Computing Product or Service (Category 5).
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Audrey
Top achievements
Rank 1
answered on 07 Oct 2013, 01:14 PM
Hello,
I try to send sms via plugin. On Android I used the plugin you linked and it works perfectly but for iOS I tried 3 plugins and no one worked... I think it comes from the plugin.xml file but I don't knoxw how to really code it !
Best regards
0
Steve
Telerik team
answered on 09 Oct 2013, 01:57 PM
Hi Audrey,

This plugin is not plugman compatible and is build against older Cordova version. You can learn how to make a plugin, plugman compatible by referring to our documentation: Make a Custom Plugin Plugman-Compatible.

I've found a more recent plugin for sending SMS for iOS here and it is already plugman compatible. Try using it instead in your Icenium app (see Import Custom Plugins) and let us know how it goes.

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Audrey
Top achievements
Rank 1
answered on 11 Oct 2013, 07:10 AM
Hi, thanks for your reply. I tried the plugin you linked but it doesn't work anymore...
0
Steve
Telerik team
answered on 15 Oct 2013, 02:09 PM
Hello Audrey,

I've modified the referenced plugin to work with Cordova 3.0 and it runs successfully in Icenium app. For your convenience I've attached a sample app that utilizes the modified plugin.

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Idan
Top achievements
Rank 1
answered on 15 Oct 2013, 04:02 PM

Anyway to also release the compatible Android SMS plugin -- Need it so bad :[
0
Idan
Top achievements
Rank 1
answered on 16 Oct 2013, 07:36 PM
According to this page, SMS is 'completed' - but I couldn't find any information about how to send SMS for both Android and iOS
0
Steve
Telerik team
answered on 18 Oct 2013, 03:06 PM
Hello Idan,

The project I've attached in the post from 18-Sep-2013 works with Cordova 2.7, so you only need to apply the modifications to plugin.xml that are listed here in order to get it running under Cordova 3.0. Plugin.xml should look like this (not tested):

<?xml version="1.0" encoding="UTF-8"?>
 
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0" id="com.phonegap.plugins.smsplugin"
        version="0.1.0">
 
  <js-module src="www/smsplugin.js" name="plugins.smsPlugin">
    <clobbers target="plugins.smsPlugin" />
  </js-module>
 
  <!-- android -->
  <platform name="android">
    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-permission android:name="android.permission.SEND_SMS" />
      <uses-permission android:name="android.permission.WRITE_SMS" />
    </config-file>
    <config-file target="res/xml/config.xml" parent="/*">
      <feature name="SmsPlugin">
        <param name="android-package" value="com.phonegap.plugins.smsplugin.SmsPlugin" />
      </feature>
    </config-file>
 
    <source-file src="src/android/SmsPlugin.java" target-dir="src/com/phonegap/plugins/smsplugin" />
  </platform>
</plugin>


Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nitesh
Top achievements
Rank 1
answered on 16 Jan 2014, 12:06 PM
Hello Steve  i used this in my app in icenium , i referred the js file in head section wrote  the code but when i build it gives one error.
0
Steve
Telerik team
answered on 17 Jan 2014, 05:29 PM
Hello Nitesh,

There is no need to register the js file manually as it is already registered by the js-module. I've provided working plugins for both iOS and Android in my replies below, so please try with any of the attachments.

Regards,
Steve
Telerik
You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
Looking for tips & tricks directly from the Icenium team? Check out our blog!
Share feedback and vote for features on our Feedback Portal.
0
Nitesh
Top achievements
Rank 1
answered on 09 Feb 2014, 02:44 PM
Hello Steve i tried android plugin but when i build that project it gives one error.
0
Steve
Telerik team
answered on 12 Feb 2014, 01:27 PM
Hi Nitesh,

As per the exception details you've provided in your other post, the problem is that the plugin should be updated to be Cordova 3.0 compatible. You will need to remove "api" from the import statement:

Was:

import org.apache.cordova.api.Plugin; 
import org.apache.cordova.api.PluginResult;

Should be:

import org.apache.cordova.CordovaPlugin; 
import org.apache.cordova.PluginResult;

For more information: Cordova 3.0 – Stuff You Should Know.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Nitesh
Top achievements
Rank 1
answered on 15 Feb 2014, 07:17 AM
Hii Steve. yes after removing api it is not giving error . but when i run my app on device it's not working it means it's not sending the message. i have enabled the wifi as well.
i have given the snapshot please check and let me know why its not working
0
Steve
Telerik team
answered on 20 Feb 2014, 04:50 PM
Hello Nitesh,

Indeed this plugin no longer works in Cordova 3.2 and we would have to look at it and see what is wrong. For the time being, you can find another Cordova plugin that works on Android and Cordova 3.x, there are quite a few results here.

Regards,
Steve
Telerik
Icenium is now Telerik AppBuilder, and is part of the Telerik Platform. For more information on the new name, and to learn more about the Platform, register for the free online keynote and webinar on Wednesday, February 12, 2014 at 11:00 a.m. ET (8:00 a.m. PT)
0
Kabir
Top achievements
Rank 2
answered on 14 Apr 2014, 08:56 AM
I integrate the SmsPlugin with Icenium app after install apk on device it gives me TypeError:cannot read property 'smsPlugin' of undefined..
any help..
0
Kaloyan
Telerik team
answered on 17 Apr 2014, 08:34 AM
Hello Kabir,

I suppose, you are trying to integrate this sms plugin. Please, correct me if I am wrong.

I managed to import it in an AppBuilder project, by:
  1. Downloading the Zip from here;
  2. Creating a new blank project inside AppBuilder;
  3. Importing the archived plugin, as described here;
  4. And finally, I added an initialization check on DeviceReady;

This resulted with success when deployed on Android device. I have attached my project for your guidance.

However, I also tried this plugin, as it supports both the iOS and the Android platforms. It also worked, after executing the above provided steps.

I hope this helps.

Regards,
Kaloyan
Telerik
 

Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

 
0
Kabir
Top achievements
Rank 2
answered on 30 Apr 2014, 04:59 AM
thanks Kaloyan sir...now its working well....
0
nosniw
Top achievements
Rank 1
answered on 01 Sep 2014, 12:56 PM
hai kaloyan,

the latest code example that you given is not working on my newest telerik version, 

there is some alert of 'SMS plugin NOT initialized!'

can i ask you for some help?

thanks
0
Kaloyan
Telerik team
answered on 04 Sep 2014, 11:12 AM
Hello nosniw,

I just tested the above provided sample and it works as expected on actual devices and native emulators. Please, note that the sample won't work in the AppBuilder simulator, as there custom plugins are disabled. Also, if you are building and deploying the application via any of our Companion Apps, it is expected the custom plugin to be undefined. This is a known limitation of our Comapnion Apps.

Further, if the above assumptions are not the issue on your side, please provide a bit more details on the matter you are experiencing. For example, on what device you are reproducing it and what is its operating system. Having the needed information, I will be happy to help you out.

Regards,
Kaloyan
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
JAGS
Top achievements
Rank 1
answered on 25 Mar 2017, 01:07 PM

hi there... i have got a problem here...after installing the sms plugin now my app wouldn't compile ... it throws up the following error

Project "JAGS INDIA.tmp.proj" (default targets): android Build Tooling revision 2017.03.21.1 origin/release-3.7.0.1 Build Tooling Hostname 43e948c75f10 Warning: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Warning: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Warning: /tmp/builds/zXLwUmf8NK2LQrsZQt/app/src/com/cordova/plugins/sms/Sms.java:56: error: cannot find symbol return cordova.hasPermission(android.Manifest.permission.SEND_SMS); ^ symbol: method hasPermission(String) Warning: location: variable cordova of type CordovaInterface Warning: /tmp/builds/zXLwUmf8NK2LQrsZQt/app/src/com/cordova/plugins/sms/Sms.java:60: error: cannot find symbol cordova.requestPermission(this, SEND_SMS_REQ_CODE, android.Manifest.permission.SEND_SMS); Warning: ^ symbol: method requestPermission(Sms,int,String) location: variable cordova of type CordovaInterface Warning: Note: Some input files use or override a deprecated API. Warning: Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Warning: 2 errors Warning: FAILURE: Build failed with an exception. * What went wrong: Warning: Execution failed for task ':compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. * Try: Run with Warning: --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Warning: /tmp/builds/zXLwUmf8NK2LQrsZQt/app/cordova/node_modules/q/q.js:126 throw e; ^ Error code 1 for command: /tmp/builds/zXLwUmf8NK2LQrsZQt/app/gradlew with args: cdvBuildDebug,-b,/tmp/builds/zXLwUmf8NK2LQrsZQt/app/build.gradle,-Dorg.gradle.daemon=true,-PcdvBuildMultipleApks=false Error: Build failed during execution Error: 'Build failed with error code 1' Done building project "JAGS INDIA.tmp.proj" -- FAILED.

0
Martin
Telerik team
answered on 29 Mar 2017, 11:05 AM
Hello,

Your project must target Cordova 5.0.0 or above in order to support the latest version of the SMS plugin. You probably have not met this requirement and that is the reason for the build errors you are receiving.

If you need any further assistance please do not hesitate to write back!

Regards,
Martin
Telerik by Progress
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Apache Cordova
Asked by
Павел
Top achievements
Rank 1
Answers by
sdobrev
Top achievements
Rank 1
Benjamin
Top achievements
Rank 1
Stefan Dobrev
Telerik team
Steve
Telerik team
Nahid
Top achievements
Rank 1
Audrey
Top achievements
Rank 1
Idan
Top achievements
Rank 1
Nitesh
Top achievements
Rank 1
Nitesh
Top achievements
Rank 1
Kabir
Top achievements
Rank 2
Kaloyan
Telerik team
nosniw
Top achievements
Rank 1
JAGS
Top achievements
Rank 1
Martin
Telerik team
Share this question
or