Giter Club home page Giter Club logo

codeigniter-gcm's Introduction

codeigniter-gcm

Codeigniter library for working with Google Cloud Messaging

Based on code of c2dm package, (c) 2011 lytsing.org & 2012 thebub.net

Simple example of usage:

// controller
public function send_gcm()
{
	// simple loading
	// note: you have to specify API key in config before
		$this->load->library('gcm');
	
	// simple adding message. You can also add message in the data,
	// but if you specified it with setMesage() already
	// then setMessage's messages will have bigger priority
		$this->gcm->setMessage('Test message '.date('d.m.Y H:s:i'));
		
	// add recepient or few
		$this->gcm->addRecepient('RegistrationId');
		$this->gcm->addRecepient('New reg id');
	
	// set additional data
		$this->gcm->setData(array(
			'some_key' => 'some_val'
		));
	
	// also you can add time to live
		$this->gcm->setTtl(500);
	// and unset in further
		$this->gcm->setTtl(false);
	
	// set group for messages if needed
		$this->gcm->setGroup('Test');
	// or set to default
		$this->gcm->setGroup(false);
	
	// then send
		if ($this->gcm->send())
			echo 'Success for all messages';
		else
			echo 'Some messages have errors';
	
	// and see responses for more info
		print_r($this->gcm->status);
		print_r($this->gcm->messagesStatuses);
			
	die(' Worked.');
}

codeigniter-gcm's People

Contributors

antongorodezkiy avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.