当前位置: 首页>>代码示例>>PHP>>正文


PHP GCM::send_notification方法代码示例

本文整理汇总了PHP中GCM::send_notification方法的典型用法代码示例。如果您正苦于以下问题:PHP GCM::send_notification方法的具体用法?PHP GCM::send_notification怎么用?PHP GCM::send_notification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GCM的用法示例。


在下文中一共展示了GCM::send_notification方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: smartpush

function smartpush($uid, $message)
{
    include "db_functions.php";
    include "gcm.php";
    $gcm = new GCM();
    $db = new DB_Functions();
    $users = $db->getAllUsers();
    if ($users != false) {
        $no_of_users = mysql_num_rows($users);
    } else {
        $no_of_users = 0;
    }
    if ($no_of_users > 0) {
        while ($row = mysql_fetch_array($users)) {
            $regId = $row['gcm_regid'];
            // $message = "สวัสดีชาวโลก";
            $registatoin_ids = array($regId);
            // $message = array("price" => $message);
            $result = $gcm->send_notification($registatoin_ids, $message);
            //echo $result;
        }
    } else {
        echo "ไม่มีข้อมูล";
    }
}
开发者ID:aclub88,项目名称:amss,代码行数:25,代码来源:smartpush.php

示例2: updateRequestStatus

function updateRequestStatus()
{
    $userRequestID = trim($_REQUEST['user_request_id']);
    $requestStatus = trim($_REQUEST['status']);
    $lastInserted_payment_id = 0;
    $rm = new Response_Methods();
    if ($userRequestID == "" || $requestStatus == "") {
        $result = $rm->fields_validation();
        return $result;
    } else {
        if ($requestStatus == 'Accepted') {
            $fromBankID = $rm->idToValue('payment_from_bank_id', 'user_requests_t', 'user_request_id', $userRequestID);
            $toBankID = $rm->idToValue('payment_to_bank_id', 'user_requests_t', 'user_request_id', $userRequestID);
            $amount = $rm->idToValue('amount', 'user_requests_t', 'user_request_id', $userRequestID);
            $fromBankBalance = $rm->idToValue('initial_bank_balance', 'bank_details_t', 'bank_id', $fromBankID);
            $toBankBalance = $rm->idToValue('initial_bank_balance', 'bank_details_t', 'bank_id', $toBankID);
            if ($fromBankBalance < $amount) {
                $result = $rm->insufficient_balance();
                return $result;
            } else {
                if ($fromBankID != $toBankID) {
                    $fromBankBalance = $fromBankBalance - $amount;
                    $toBankBalance = $toBankBalance + $amount;
                }
                $updateFromBankBalance['initial_bank_balance'] = $fromBankBalance;
                $affectedRowsFrom = $rm->update_record($updateFromBankBalance, 'bank_details_t', 'bank_id', $fromBankID);
                $updateToBankBalance['initial_bank_balance'] = $toBankBalance;
                $affectedRowsTo = $rm->update_record($updateToBankBalance, 'bank_details_t', 'bank_id', $toBankID);
                $getInsertFieldValue['amount'] = $amount;
                $getInsertFieldValue['payment_from_bank_id'] = $fromBankID;
                $getInsertFieldValue['payment_to_bank_id'] = $toBankID;
                $getInsertFieldValue['user_request_id'] = $userRequestID;
                $lastInserted_payment_id = $rm->insert_record($getInsertFieldValue, 'payment_details_t');
                $login_user_id = $rm->idToValue('login_user_id', 'user_requests_t', 'user_request_id', $userRequestID);
                $gcm_regid = $rm->getUserGCMREGID($login_user_id);
                if ($gcm_regid != "" || $gcm_regid != "NA") {
                    $gcm = new GCM();
                    $registatoin_ids = array($gcm_regid);
                    $msg = "Request " . $requestStatus;
                    $message = array("Response" => $msg);
                    $resultPush = $gcm->send_notification($registatoin_ids, $message);
                }
                $getRegisterFieldValue['status'] = $requestStatus;
                $affectedRows = $rm->update_record($getRegisterFieldValue, 'user_requests_t', 'user_request_id', $userRequestID);
                if ($affectedRows >= 0) {
                    $result = $rm->requestStatusSuccess($lastInserted_payment_id);
                    return $result;
                } else {
                    $result = $rm->requestStatusFail();
                    return $result;
                }
            }
        }
    }
}
开发者ID:Kavitapsawant,项目名称:Axis-Group,代码行数:55,代码来源:updateRequestStatus.php

示例3: mailing

 function mailing() {
     $gcm = new GCM();
     file_put_contents('mylog.log',"  1----<br>_SEND NOTIFICATION_<br>----  ", FILE_APPEND);
     $result = $dbManager->query("SELECT * FROM `Users` WHERE id IN (SELECT idUser FROM `Сourier`)");
     
     while($row = $dbManager->fetch_assoc($result)) {
         $registatoin_ids = $row['registerId'];
         
         file_put_contents('mylog.log',"  2----<br>_SEND NOTIFICATION_<br>----  ", FILE_APPEND);
         $gcm->send_notification($registatoin_ids, "DEBUG");    
     }
     
             
 }
开发者ID:NG-Studio-Development,项目名称:web-veloportation,代码行数:14,代码来源:index.php

示例4: addUserRequest

function addUserRequest()
{
    //$companyId = $_REQUEST['companyId'];
    $login_user_id = trim($_REQUEST['userID']);
    $fromBankID = trim($_REQUEST['fromBankID']);
    $toBankID = trim($_REQUEST['toBankID']);
    //$paymentDate = trim($_REQUEST['paymentDate']);
    //$paymentReason = trim($_REQUEST['paymentReason']);
    $amount = trim($_REQUEST['amount']);
    $paymentType = trim($_REQUEST['paymentType']);
    $rm = new Response_Methods();
    if ($login_user_id == "" || $fromBankID == "" || $amount == "" || $paymentType == "") {
        $result = $rm->fields_validation();
        return $result;
    } else {
        date_default_timezone_set('Asia/Calcutta');
        $createdDate = date('Y-m-d H:i:s');
        $getList = array();
        //inserting payment details
        $getInsertFieldValue['login_user_id'] = $login_user_id;
        $companyID = $rm->idToValue('company_id', 'user_details_t', 'login_user_id', $login_user_id);
        $getInsertFieldValue['payment_from_bank_id'] = $fromBankID;
        $getInsertFieldValue['payment_to_bank_id'] = $toBankID;
        //$getInsertFieldValue['payment_date']=$paymentDate;
        //$getInsertFieldValue['payment_reason']=$paymentReason;
        $getInsertFieldValue['amount'] = $amount;
        $getInsertFieldValue['payment_type'] = $paymentType;
        $getInsertFieldValue['request_created_date'] = $createdDate;
        $getInsertFieldValue['company_id'] = $companyID;
        $lastInserted_user_request_id = $rm->insert_record($getInsertFieldValue, 'user_requests_t');
        if (!empty($lastInserted_user_request_id)) {
            //Do Transactions by updating bank current balance
            /* Sending Push Notification to Admin */
            $gcm_regid = $rm->getUserGCMREGID(2);
            if ($gcm_regid != "" || $gcm_regid != "NA") {
                $gcm = new GCM();
                $registatoin_ids = array($gcm_regid);
                $msg = "User Payment Request Made. Please Check";
                $message = array("Response" => $msg);
                $resultPush = $gcm->send_notification($registatoin_ids, $message);
            }
            $result = $rm->userRequestSuccessJson($lastInserted_user_request_id);
            return $result;
        } else {
            $result = $rm->userRequestFailJson();
            return $result;
        }
    }
}
开发者ID:Kavitapsawant,项目名称:Axis-Group,代码行数:49,代码来源:addUserRequests.php

示例5: gcm_register

/**
 * Created by PhpStorm.
 * Date: 12/7/2015
 * Time: 12:30 PM
 * @param $regId
 * @param $account
 * @param $name
 * @return mixed
 * @throws InvalidParameterException
 */
function gcm_register($regId, $account, $name)
{
    if (!$account) {
        $response['status'] = 1;
        $response['result'] = 'please enter valid user account';
        return $response;
        exit;
    } else {
        $user = get_user_by_username($account);
        if (!$user) {
            throw new InvalidParameterException('registration:usernamenotvalid');
            $response['status'] = 1;
            $response['result'] = 'user account not valid';
            return $response;
            exit;
        }
    }
    // create the tables for API stats
    $path = elgg_get_plugins_path();
    run_sql_script($path . "elgg_with_rest_api/schema/mysql.sql");
    if ($account && $regId) {
        $elgg_post = 1;
        $elgg_message = 1;
        // Store user details in db
        include_once $path . 'elgg_with_rest_api/lib/DB_Register_Functions.php';
        include_once $path . 'elgg_with_rest_api/lib/GCM.php';
        $db = new DB_Register_Functions();
        $gcm = new GCM();
        if ($db->checkUser($regId)) {
            $res = $db->updateUser($name, $account, $regId, $elgg_post, $elgg_message);
            $response['status'] = 0;
            $response['result'] = "success update gcm regId and user info";
        } else {
            $res = $db->storeUser($name, $account, $regId, $elgg_post, $elgg_message);
            $registration_ids = array($regId);
            $message = array("from_name" => "Core Server", "subject" => "Core App Notification", "message" => "Enable Receive Notification");
            $result = $gcm->send_notification($registration_ids, $message);
            $response['status'] = 0;
            $response['result'] = "success Insert gcm regId and user info";
        }
    } else {
        // user details missing
        $response['status'] = 1;
        $response['result'] = 'Missing name or reg id';
    }
    return $response;
}
开发者ID:rohit1290,项目名称:elgg_with_rest_api,代码行数:57,代码来源:gcm_register.php

示例6: send_notification

function send_notification($status, $id)
{
    global $db;
    $gcm = new GCM();
    if ($status == 0 || $status == "0") {
        $query = "SELECT * FROM login,family WHERE member_id = '{$id}' AND id = family_id ";
        $result = $db->query_db($query);
        if ($db->number_of_rows($result) > 0) {
            while ($row = $db->fetch_array($result)) {
                $regId = $row["gcm_regId"];
                $message = " is in danger";
                $registatoin_ids = array($regId);
                $message = array("message" => $message, "id" => $id);
                $notification_result = $gcm->send_notification($registatoin_ids, $message);
            }
        } else {
            // no family members are found
        }
    }
}
开发者ID:navneet1v,项目名称:Disaster-Safety,代码行数:20,代码来源:change_status.php

示例7: distribusiSurat

function distribusiSurat($db, $token, $id_surat, $subject, $tu, $tembusan, $nama_institusi)
{
    $tujuan = explode("@+id/", $tu);
    // explode dulu tujuannya
    $registration_ids = array();
    for ($i = 0; $i < count($tujuan); $i++) {
        if (!empty($tujuan[$i])) {
            //            echo $id_surat . " - " . $tujuan[$i] . " - " . $tembusan . " <br/>";
            kirimSurat($db, $id_surat, $tujuan[$i], $tembusan);
            if (!empty(pushNotification($db, $tujuan[$i]))) {
                $registration_ids = pushNotification($db, $tujuan[$i]);
            }
        }
    }
    if (count($registration_ids) > 0) {
        $gcm = new GCM();
        $pesan = array("message" => $subject, "title" => "Surat baru dari {$nama_institusi}", "msgcnt" => 1, "sound" => "beep.wav");
        $result = $gcm->send_notification($registration_ids, $pesan);
    } else {
        $result = '"Not a GCM User"';
    }
    echo '{"isUnreads": ' . countUnreads($token) . ', "isFavorites": ' . countFavorites($token) . ', "isUnsigned": ' . countUnsigned($token) . ', "result": ' . $result . '}';
    //    echo $result;
}
开发者ID:agungsb,项目名称:notifion-api,代码行数:24,代码来源:index.php

示例8: GCM

<?php

if (isset($_POST["title"]) && isset($_POST["message"])) {
    $title = $_POST["title"];
    $message = $_POST["message"];
    include_once './gcm.php';
    $gcm = new GCM();
    $result = $gcm->send_notification($title, $message);
    echo $result;
}
开发者ID:callmegoon,项目名称:digital-summit-app,代码行数:10,代码来源:send_message.php

示例9: Helper

 function send_pn_action()
 {
     $helper_obj = new Helper();
     if ($helper_obj->user_is_logged_in() && $helper_obj->check_role(SUPER_ADMIN_ROLE_ID)) {
         $db_functions_obj = new DbFunctions();
         $cid = $_POST['add_client'];
         $msg = $_POST['msg'];
         $client_info = $db_functions_obj->get_client_by_id($cid);
         $tokens = $db_functions_obj->get_tokens($cid);
         define("GOOGLE_API_KEY", $client_info->api);
         // Place your Google API Key
         include_once 'includes/classes/GCM.php';
         $gcm = new GCM();
         foreach ($tokens as $token) {
             $user_token = $token->token;
             $type = $token->type;
             //ios
             if ($type == 1) {
                 $pn_obj = new PushNotification();
                 $pn_obj->push_notification($msg, $user_token, 2, $client_info->pem);
             } else {
                 if ($type == 2) {
                     $m = array("message" => $msg);
                     $deviceId[] = $user_token;
                     $result = $gcm->send_notification($deviceId, $m);
                 }
             }
         }
         exit;
     }
 }
开发者ID:arh922,项目名称:ain,代码行数:31,代码来源:controller.php

示例10: array

<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
if (isset($_GET["caseNum"])) {
    // include config
    include_once './db_functions.php';
    $title = $_GET["title"];
    $message = $_GET["message"];
    $caseNum = $_GET["caseNum"];
    $db = new DB_Functions();
    $regId = $db->getUserRegIdByCaseNum($caseNum);
    $regIdarr = array();
    array_push($regIdarr, $regId);
    include_once './GCM.php';
    $gcm = new GCM();
    $message = array("message" => $message, "title" => $title);
    $result = $gcm->send_notification($regIdarr, $message);
    echo $result;
}
开发者ID:neoza,项目名称:testdashboard,代码行数:21,代码来源:sendupdatemessage.php

示例11: GCM

         if ($driver_gcm_id != '') {
             $gcm = new GCM();
             $user['Traveler_name'] = $user_name;
             $user['Traveler_mobile'] = $user_mobile;
             $user['Pickup_address'] = $user_location;
             $user['Travel_time'] = $user_time;
             $user['Vehicle_type'] = '';
             $user['From'] = $user_location;
             $user['To'] = '';
             $user['Trip_id'] = $id;
             $user['ridestatus'] = 'RideLater';
             $user['Packages'] = '';
             $notification['message'][] = $user;
             $notifications = json_encode($notification);
             $message = "Customer Name : {$user_name},Mobile : {$user_mobile},Pickup Location : {$user_location},Strat Time : {$user_time}";
             $gcm->send_notification(array($driver_gcm_id), $notifications);
         }
         $to = $user_email;
         $name = $user_name;
         $subject = "Trip Assign Confirmation";
         $message = "\n<html>\n<head>\n<title>HTML email</title>\n</head>\n<body>\n<table bgcolor='#F4F4F4' align='center' cellspacing='0' cellpadding='0' border='0' style='width:600px'>\n<tbody>\n<tr>\n<td width='600' style='border:1px solid #ccc;'>\n\n<table align='center' cellspacing='0' cellpadding='0' border='0' style='width:100%'>\n<tbody>\n<tr><td><a target='_blank' href='http://maruthicabs.com/images/logo.png'><img border='0' alt='maruthicabs' src='http://maruthicabs.com/images/logo.png' width='25%'height='60' style='padding:5px;'></a></td></tr>\n</tbody>\n</table>\n<table bgcolor='#ffffff' align='center' cellspacing='0' cellpadding='0' border='0' style='width:600px'>\n<tbody>\n<tr>\n<td height='32' align='center' colspan='2' style='background:#f0c004'>\n<a target='_blank' style='color:#fff;font-weight:bold; font-family:Arial; font-size:20px; text-decoration:none; padding:0px 15px'>Trip Assign Confirmation</a>\n</td>\n</tr>\n<tr>\n<td colspan='2' height='15'>&nbsp;</td>\n</tr>\n<tr>\n<td>\n<table cellspacing='0' cellpadding='0' border='0' style='width:600px'>\n<tbody>\n<tr>\n<td width='15' height='100%'>&nbsp;</td>\n<td valign='top'>\n\n<p style='margin-top:5px;font-family:Arial;color: #333;'>Dear {$name}, </p>\n<p style='margin-top:5px;font-family:Arial;color: #333;'>Thank you for choosing Maruthicabs for {$user_time}, Cab No: {$vehicle_reg}, Chauffer: {$drivername}, Cell: {$driver_number} will reach you.  Conditions Apply. </p>\n<div style='clear:both;'></div>\n<div style='clear:both;'></div>\n<p style='margin-top:15px; margin-bottom:2px;font-family:Arial;color: #333;'>Regards</p>\n\n<p style='margin-top:1px;font-family:Arial;color: #333;'>Maruthi Cabs Team</p>\n</td>\n<div style='clear:both;'></div>\n<td width='15' height='100%'>&nbsp;</td>\n</tr>\n\n<tr>\n<td colspan='2' height='15'>&nbsp;</td>\n</tr>\n</tbody>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n\n<table cellspacing='0' cellpadding='0' border='0' style='width:600px'>\n<tr>\n<td bgcolor='#f4f4f4' align='center' style='font-family:Arial;font-size:12px;line-height:20px; padding:10px 0px; color:#666;'>\n<span style='color:#6a6a6a'>\n&copy;2015, <a target='_blank' href='http://maruthicabs.com/'>Maruthi Cabs</a> All Rights Reserved. </span> <br>\n</td>\n</tr>\n</table>\n</td>\n</tr>\n</tbody>\n</table>\n</body>\n</html>\n";
         // Always set content-type when sending HTML email
         $headers = '';
         $headers .= 'MIME-Version: 1.0' . "\r\n";
         $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
         $headers .= 'From: Mcabs.ee<' . mcabs . '>' . "\r\n";
         $mail = mail($to, $subject, $message, $headers);
     } else {
         echo "<div class='admin_faile'>Assigned Failed.</div>";
     }
 } else {
开发者ID:rayudu444,项目名称:maruthi,代码行数:31,代码来源:assign-trip.php

示例12: GCM

<?php

if (isset($_GET["regId"]) && isset($_GET["message"])) {
    $regId = $_GET["regId"];
    $message = $_GET["message"];
    include_once './GCM.php';
    $gcm = new GCM();
    $registrationIds = [$regId];
    $message = ["price" => $message];
    $result = $gcm->send_notification($registrationIds, $message);
    echo $result;
}
开发者ID:RickyCruz,项目名称:Curso-Datafit-Android-Notificaciones-Push,代码行数:12,代码来源:send_message.php

示例13: array

<?php

require_once "../php_include/config.php";
require_once "../GCM.php";
$reg_ids[] = 'APA91bGyIHXA78mAr9-Q4FxFBPxyQrQmMre5oWAnbchAID0_dLsegdHkgiuVhvIsCby72I6NLsU8bl5Pk6aCMO6vHecVSPNY8N9edY7pei41T6xMb4j6a0zfUc51GTEdZnajolPPgPEB';
if (!empty($reg_ids)) {
    $push_data = array('push_type' => '6', 'data' => array('message' => 'Dummy push to gcm user'));
    try {
        GCM::send_notification($reg_ids, $push_data);
    } catch (Exception $e) {
        //echo $e->getMessage();
    }
}
开发者ID:Gameonn,项目名称:tinder,代码行数:13,代码来源:send_push_to_gcm.php

示例14: die

            }
            $result_sendername = mysqli_query($conn, "SELECT *  FROM usertable where userid='{$fromid}'") or die(mysql_error());
            if (mysqli_num_rows($result_sendername) > 0) {
                while ($row = $result_sendername->fetch_assoc()) {
                    $sender_name = $row['firstname'];
                    $sender_lname = $row['lastname'];
                    $logintype = $row['logintype'];
                }
            }
            $result = mysqli_query($conn, "SELECT * FROM usertable where userid='{$toid}'") or die(mysql_error());
            if (mysqli_num_rows($result) > 0) {
                while ($row = $result->fetch_assoc()) {
                    include_once './GCM.php';
                    $regId = $row["gcmid"];
                    $gcm = new GCM();
                    $registatoin_ids = array($regId);
                    $res = $gcm->send_notification($registatoin_ids, $message, $sender_name, $fromid, $sender_lname, $logintype, $chattype, $messagetype);
                }
                //end of while
            }
        } else {
            $response["success"] = "block";
            $response["message"] = "You can not message this user.";
            echo json_encode($response);
        }
    } else {
        $response["success"] = "false";
        $response["message"] = "User Not Logged in.";
        echo json_encode($response);
    }
}
开发者ID:joaokiosfera,项目名称:MedicalServiceWebservice,代码行数:31,代码来源:sendIndividualMessage.php

示例15: array

        }
        if ($_POST['func'] == "ejemplo_push") {
            //ejemplo push
            $extraData = array('notifType' => 'chat', 'perros_id' => $notif['perros_id'], 'amigos_usuarios_id' => $notif['usuario_id'], 'usuario_nombre' => $notif['amigos_nombre']);
            /*if($notif['goto'] == 'video'){
                  $notifMgs = "Hay empresas que te quieren conocer";
              }else{*/
            $notifMgs = "Purina Walk Chat " . $notif['nombre'] . ": " . $notif['mensaje'];
            //}
            //$notifMgs = utf8_decode($notif['notificacion'] . " " .$notif['descripcion']);
            //$notifMgs = "Hay empresas que te quieren conocer";
            if ($notif['plataforma'] != "") {
                if ($notif['plataforma'] == 'Android') {
                    //echo 'send notif android';
                    $GCM = new GCM();
                    $GCM->send_notification(array('0' => $notif['regid']), $notifMgs, $extraData);
                } else {
                    //echo 'send notif IOS';
                    /*$NOTIF_IOS = new NOTIF_IOS();
                      $NOTIF_IOS->send_notification( array('0' => $notif['regid']), $notifMgs, $extraData);*/
                }
            }
        }
        $response['arrayData']['id'] = @(string) $_POST['id'];
    }
    //send_emails(utf8_decode($emailContent), $emailSubject, unserialize(EMAIL_ADMIN_UR));
}
$responseJson = json_encode($response);
if (@$_POST['callback']) {
    echo $_POST['callback'] . "(" . $responseJson . ")";
} else {
开发者ID:georgex1,项目名称:bp-unity-nuevo-proyecto,代码行数:31,代码来源:response.php


注:本文中的GCM::send_notification方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。