2017-06-29 10 views
0

私はコルドバで新しいです。私はコードオフプッシュ通知を使用したいと思います。誰も私がプラグインを使用するのを助けることができますか?Cordovaプラグインプッシュ通知が機能しませんか?

Error: Failed to fetch plugin https://github.com/zckrs/cordova-plugin-android-support-v4.git via registry. 
Probably this is either a connection problem, or plugin spec is incorrect. 
Check your connection and plugin name/version/URL. 

Error: cmd: Command failed with exit code 1 Error output: 
npm WARN package.json [email protected] No repository field. 
npm WARN package.json [email protected] No README data 
npm WARN addRemoteGit Error: not found: git 
npm WARN addRemoteGit at getNotFoundError (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:14:12) 
npm WARN addRemoteGit at F (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:69:19) 
npm WARN addRemoteGit at E (C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:81:29) 
npm WARN addRemoteGit at C:\Program Files\nodejs\node_modules\npm\node_modules\which\which.js:90:16 
npm WARN addRemoteGit at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\index.js:44:5 
npm WARN addRemoteGit at C:\Program Files\nodejs\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:29:5 

npm ERR! node v4.4.7 
npm ERR! npm v2.15.8 
npm ERR! code ENOGIT 

npm ERR! not found: git 
npm ERR! 
npm ERR! Failed using git. 
npm ERR! This is most likely not a problem with npm itself. 
npm ERR! Please check if you have git installed and in your PATH. 

npm ERR! Please include the following file with any support request: 
npm ERR! D:\ExerciseApp\node_modules\npm-debug.log 

答えて

0

phonegap-plugin-pushを使用する必要があります。

は、Androidサポートv4クライアントライブラリを追加するプラグインで、プッシュ通知ではありません。

あなたはCMDで次のように入力してphonegap-plugin-pushを追加することができます -

cordova plugin add phonegap-plugin-push 

または

cordova plugin add https://github.com/phonegap/phonegap-plugin-push 

例 -

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

     var push = PushNotification.init({ "android": {"senderID": "91254247XXXX"}}); //add your sender ID from Firebase Cloud Messenging 

     push.on('registration', function(data) { 
      console.log(data.registrationId); 
      //document.getElementById("gcm_id").innerHTML = data.registrationId; 
     }); 

     push.on('notification', function(data) { 

      alert("On Notification function!!"); 
      // data.message, 
      // data.title, 
      // data.count, 
      // data.sound, 
      // data.image, 
      // data.additionalData 
      console.log("notification event"); 
      console.log(JSON.stringify(data)); 
      alert(JSON.stringify(data)); 
      //Do something 
     }); 

     push.on('error', function(e) { 
      alert(e); 
     }); 
    } 

注 - 必要アンドロイドプラットフォームのFirebase Cloud Messengingにアプリを追加し、送信者IDをFirebase Console->Setting->Cloud Messenging Tabから取得してください。

関連する問題