Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Android Iphone push notifications php API

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2
    Comment on it

    Push notifications are messages that allow an app to notify of a message similar to how a text message pops up on your screen with a sound.Code for Android ,Iphone API push notification is given below by using urban airship

    1. Android Push Notification

      $apiKey = 'XXXXXXXXXXXXXXX';
      // Device Token $token = 'XXXXXXXXXXXXXXXX';
      // Message that has to be sent on device $message ='Hello World! My test notification.';
      // Additional data or parameter if required to send along with message $any = 'test'; // Set POST variables $url = 'https://android.googleapis.com/gcm/send'; $fields = array('registrationids' => $token,'data' => array("message" => $message,"any"=>$any)); $headers = array('Authorization: key=' . $apiKey,'Content-Type: application/json'); // Open connection $ch = curlinit(); // Set the url, number of POST vars, POST data curlsetopt( $ch, CURLOPTURL, $url ); curlsetopt( $ch, CURLOPTPOST, true ); curlsetopt( $ch, CURLOPTHTTPHEADER, $headers); curlsetopt( $ch, CURLOPTRETURNTRANSFER, true );
      curlsetopt($ch, CURLOPTSSLVERIFYPEER, false);
      curl
      setopt($ch, CURLOPTPOSTFIELDS, jsonencode( $fields )); // Execute post $result = curlexec($ch); // Close connection curlclose($ch); $errchk = jsondecode($result);

    fegr

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: