public
class
GCMIntentService
extends
GCMBaseIntentService
{
@Override
protected
void
onError(Context context, String errorId)
{
}
@SuppressWarnings
(
"deprecation"
)
@Override
protected
void
onMessage(Context context, Intent intent)
{
String msg = intent.getStringExtra(
"msg"
);
String title = intent.getStringExtra(
"title"
);
String tickerText =
"새로운 공지사항이 있습니다."
;
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
PendingIntent pendingIntent = PendingIntent.getActivity(GCMIntentService.
this
,
0
,
new
Intent(GCMIntentService.
this
, EtcBoard.
class
),
0
);
Notification notification =
new
Notification();
WakeLock.acquireCpuWakeLock(
this
);
notification.icon = R.drawable.app_icon_60;
notification.tickerText = tickerText;
notification.when = System.currentTimeMillis();
notification.vibrate =
new
long
[] {
500
,
100
,
500
,
100
};
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(GCMIntentService.
this
, title, msg, pendingIntent);
notificationManager.notify(
0
, notification);
WakeLock.releaseCpuLock();
}