Search code examples
javascriptandroidcordovacordova-plugins

cordova: module "cordova/plugin/SmsInboxPLugin not found


I am trying to use the sms-reception-plugin. I created the plugin.xml

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
       id="cordova.plugin"
  version="0.1.2" >

<name>SmsReception</name>
<description>Cordova SmsReception Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova,smsreception</keywords>


<js-module src="www/SmsInboxPlugin.js" name="cordova.plugin.smsplugin">
    <clobbers target="cordova.plugin" />
</js-module>

<!-- android -->
<platform name="android">
    <config-file target="res/xml/config.xml" parent="/*">
        <feature name="SmsPlugin">
          <param name="android-package" value="org.apache.cordova.plugin.SmsInboxPlugin" />
        </feature>
    </config-file>

    <source-file src="src/android/SmsInboxPlugin.java" target-dir="src/org/apache/cordova/plugin" />
    <source-file src="src/android/SmsReceiver.java" target-dir="src/org/apache/cordova/plugin" />

</platform>

</plugin>

Then i used this code in .html var smsPlugin = cordova.require('cordova/plugin/smsplugin'); still its showing the error Uncaught module cordova/plugin/smsplugin not found I created the plugin.xml as described in here. If any body have any idea help me.


Solution

  • Try to check for the name property in the js-module. I have this problem while using the same plugin, it should me same as the Plugin name.

    If it doesn't work switch to other one PhoneGap-SMS Plugin. This will be useful.

    If you will read this document about the plugins in cordova you will get the idea, how these plugins are built. Cordova Plugin Documentation