2016-06-08 78 views
0

我爲我的項目添加了搖動手勢插件。爲什麼搖動事件不起作用phonegap?

這是我的代碼:

<button onclick="myFunc()" id="round">Gesture Call</buttom> 
    <script> 

     function myFunction() 
     { 
      window.open("emcall.html"); 
      navigator.vibrate([2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,2000]); 
      navigator.notification.beep(10); 

     } 
     function myFunc() 
     { 
      alert('shake working'); 
      function onShake() 
      { 
       alert("shake success"); 
       window.open("emcall.html"); 

      } 

      function onError() 
      { 
       alert("errorq"); 

      } 
      shake.startWatch(onShake,30,onError); 


     } 

    </script> 

有些事情錯在mycode的幫助我克服此問題。

+0

你有沒有下載shake插件? – wot

+0

@ e4en yeah通過cli downloded –

+0

它不工作的系統是什麼?你嘗試過別人嗎? – ste2425

回答

0

- >在phonegap.app中不支持的插件,他們都是在phonegap應用程序上使用您的ip地址測試應用程序。

- >只需通過cli添加平臺。

- >並建立或運行它並測試。

3

cordova.js文件包含在您的HTML文件中,並在您的腳本中註冊deviceready事件。然後,在deviceready事件偵聽器函數中調用與插件相關的代碼。它應該工作。

此外,確保在添加和構建平臺後在設備上進行測試,因爲我沒有看到瀏覽器支持的這個動態插件。

+0

兄弟謝謝我被upvoted你的答案,因爲你和另外一個成員是有理由找到解決方案 –

+0

@KishoreKumar沒有問題兄弟。 – Gandhi

相關問題