1 Reply Latest reply on Oct 21, 2017 11:47 AM by fzammetti

    Vibration not working unless debugging enabled and phonegap.js imported

    fzammetti

      Hi,

       

      I have an app that I'm building with PhoneGap Build and I'm having an issue where vibration only works if the app has debugging enabled AND if I manually include phonegap.js and both things seem to be wrong to me.

       

      Here's my config.xml file:

       

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

      <widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:gap="http://phonegap.com/ns/1.0"
        id="com.etherient.wxPIM"
        version="1.0.0">

        <name>test</name>

        <description>test</description>

        <preference name="phonegap-version" value="cli-6.5.0" />

        <plugin name="cordova-plugin-vibration" spec="2.1.5" />

      </widget>

       

      And, here's my index.html file:

       

      <!DOCTYPE html>

      <html>

        <head>

        <script type="text/javascript" src="phonegap.js"></script>

        <title>test</title>

        <script>

          document.addEventListener("deviceready", onDeviceReady, false);

          function onDeviceReady() {

            navigator.vibrate(3000);

          }

        </script>

        </head>

        <body>test</body>

      </html>

       

      Simple, right?  But, on my Android device (Galaxy S7), if I remove either that phonegap.js import or turn debugging off in the PGB app console, then vibrate doesn't work, but it DOES work with both those conditions met.

       

      Can anyone help me with this?  Because it seems like neither of those conditions should need to be true and importing phonegap.js I thought was explicitly NOT supposed to be done.  FYI, importing cordova.js doesn't make a different, and including the following in config.xml doesn't either:

       

      <feature name="Notification">

        <param name="android-package" value="org.apache.cordova.Notification" />

      </feature>

       

      Thanks!

      Frank