Last active
December 27, 2015 01:53
-
-
Save cavarzan/947df18d57d0ccf9e651 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PushIntentService extends IntentService { | |
@Override | |
protected void onHandleIntent(Intent intent) { | |
handleNotification(intent.getExtras()); | |
} | |
private void handleNotification(Bundle extras) { | |
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); | |
Notification notification = extras.getParcelable(Extras.NOTIFICATION); | |
if (notification == null) { | |
return; | |
} | |
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) | |
.setSmallIcon(R.mipmap.ic_launcher) | |
.setContentTitle(notification.title) | |
.setContentText(notification.message) | |
.setAutoCancel(true); | |
mNotificationManager.notify("default-push", 1, mBuilder.build()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment