Search in sources :

Example 1 with RandomEvent

use of com.commonsware.android.parcelable.marshall.RandomEvent in project cw-omnibus by commonsguy.

the class ScheduledService method onNoSubscriber.

@Subscribe
public void onNoSubscriber(NoSubscriberEvent event) {
    RandomEvent randomEvent = (RandomEvent) event.originalEvent;
    NotificationCompat.Builder b = new NotificationCompat.Builder(this);
    Intent ui = new Intent(this, EventDemoActivity.class);
    b.setAutoCancel(true).setDefaults(Notification.DEFAULT_SOUND).setContentTitle(getString(R.string.notif_title)).setContentText(Integer.toHexString(randomEvent.value)).setSmallIcon(android.R.drawable.stat_notify_more).setTicker(getString(R.string.notif_title)).setContentIntent(PendingIntent.getActivity(this, 0, ui, 0));
    NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mgr.notify(NOTIFY_ID, b.build());
}
Also used : NotificationManager(android.app.NotificationManager) NotificationCompat(android.support.v4.app.NotificationCompat) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) RandomEvent(com.commonsware.android.parcelable.marshall.RandomEvent) Subscribe(org.greenrobot.eventbus.Subscribe)

Aggregations

NotificationManager (android.app.NotificationManager)1 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 NotificationCompat (android.support.v4.app.NotificationCompat)1 RandomEvent (com.commonsware.android.parcelable.marshall.RandomEvent)1 Subscribe (org.greenrobot.eventbus.Subscribe)1