Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 通过firebase收到通知时,Cordova振动不工作_Android_Cordova_Push Notification - Fatal编程技术网

Android 通过firebase收到通知时,Cordova振动不工作

Android 通过firebase收到通知时,Cordova振动不工作,android,cordova,push-notification,Android,Cordova,Push Notification,嗨,我在应用程序中工作,它接收推送通知。每件事都很好,但当通知到来时,我并没有得到震动。请帮助我如何解决此错误 我的php代码 <?php // API access key from Google API's Console define( 'API_ACCESS_KEY', 'AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxx' ); $registrationIds = array( $_GET['id'] ); // prep the bundle $msg = ar

嗨,我在应用程序中工作,它接收推送通知。每件事都很好,但当通知到来时,我并没有得到震动。请帮助我如何解决此错误

我的php代码

<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'AIzaSyxxxxxxxxxxxxxxxxxxxxxxxxxx' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
(
    'body'  => $_GET['body'],
    'title'     => $_GET['title'],
    'vibrate'   => true,
    'sound'     => true,
);

$fields = array
(
    'registration_ids'  => $registrationIds,
    'data'                  => $msg,
        'notification'      => $msg
);

$headers = array
(
    'Authorization: key=' . API_ACCESS_KEY,
    'Content-Type: application/json'
);

$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close($ch);
//echo $result;
echo json_encode(array("data"=>$msg));
?>  

你在哪里触发振动?我在我的php文件中触发振动这对我来说毫无意义,要不要解释一下?你在哪里触发振动?我在我的php文件中触发振动这对我来说毫无意义,要不要解释一下?
FCMPlugin.onNotification(function(data){


            if(data.wasTapped){

                            //alert( JSON.stringify(data.title) );
                             if(data.title=="New Order"){

                            //     alert("->"+data.body);
                                 localStorage.setItem("orderr", JSON.stringify(data.body));
                                window.location="new_order.html";
                                 }
                        }else{

                        //  alert( JSON.stringify(data) );
                          if(data.title=="New Order"){
                        //    alert("->"+data.body);

                                 localStorage.setItem("orderr", JSON.stringify(data.body));
                                 window.location="new_order.html";

                          }
                        }

                      },
                      function(msg){
                          //alert('onNotification callback successfully registered: ' + msg);
                      },
                      function(err){
                        //  alert('Error registering onNotification callback: ' + err);
                      }
                    );

                     function onBackKeyDown() {
                alert("Can't Go Back");

            //navigator.app.backHistory();
            // window.location="main.html";
            }

            };