Skip to content

Instantly share code, notes, and snippets.

View vivex's full-sized avatar
💻
Building

Vivek Soni vivex

💻
Building
View GitHub Profile
APP_ENV=testing
APP_DEBUG=true
APP_KEY=key
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=sample
DB_USERNAME=shippable
DB_PASSWORD=
language: php
php:
- 5.6
services:
- mysql
addons:
hosts:
try {
Result result = sender.send(msg2, account.getGcmRegId(), retries);
if (StringUtils.isEmpty(result.getErrorCodeName())) {
System.out.println(msg2.toString() + "GCM Notification is sent successfully" + result.toString());
return true;
}
System.out.println("Error occurred while sending push notification :" + result.getErrorCodeName());
Message msg = new Message.Builder().build();
Message msg2 = new Message.Builder().addData("message","Something New for You").build();
Sender sender = new Sender(GCM_API_KEY);
/**
* Created by vivex on 12/6/15.
*/
@Service
public class NotificationService {
/**
* gcmRegId is the id which android app will give to server (one time)
**/
public boolean pushNotificationToGCM(String gcmRegId,String message){
<dependency>
<groupId>com.ganyo</groupId>
<artifactId>gcm-server</artifactId>
<version>1.0.2</version>
</dependency>