android - Create google GCM testing app in emulator and get registration id using PHP -


i'm trying create testing app run @ emulator , gcm server use php.

i'm looking code how pushes message target device, following code downloaded somewhere:

<?php       $json = array();       $regid = $_get["regid"];   $msg = $_get["msg"];   if (isset($regid) && isset($msg)) {       require_once("gcm.php");        $message = array("message" => $msg);       $regid = explode(",", $regid);       $result = gcm_push_notification($regid, $message);        $success_code = json_decode($result,true)["success"];       if($success_code > 0){     //echo $result; //     echo $success_code."/".count($regid); //       }else{     echo "error";       }   } else {       echo "error";   } ?> 

the code every time need "registration id"s send message:

  • i wondering how can registration ids every time before sending message?
  • and if create simple app run @ emulator only, generate registration id? how that?

you create database , store registration id's in server. , emulators can generate gcm id. make sure set emulator target google api. if emulator running android 4.0 , below, add google account emulator.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -