Search in sources :

Example 1 with NotificationManager

use of android.app.NotificationManager 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)

Example 2 with NotificationManager

use of android.app.NotificationManager in project cw-omnibus by commonsguy.

the class MainActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mgr.notify(NOTIFY_ID, buildNormal().build());
    finish();
}
Also used : NotificationManager(android.app.NotificationManager)

Example 3 with NotificationManager

use of android.app.NotificationManager 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) Subscribe(org.greenrobot.eventbus.Subscribe)

Example 4 with NotificationManager

use of android.app.NotificationManager in project cw-omnibus by commonsguy.

the class ScheduledService method doWakefulWork.

@Override
protected void doWakefulWork(Intent intent) {
    Intent event = new Intent(EventLogFragment.ACTION_EVENT);
    long now = Calendar.getInstance().getTimeInMillis();
    int random = rng.nextInt();
    event.putExtra(EventLogFragment.EXTRA_RANDOM, random);
    event.putExtra(EventLogFragment.EXTRA_TIME, now);
    if (!LocalBroadcastManager.getInstance(this).sendBroadcast(event)) {
        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(random)).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)

Example 5 with NotificationManager

use of android.app.NotificationManager in project cw-omnibus by commonsguy.

the class ScheduledService method onDeadEvent.

@Subscribe
public void onDeadEvent(DeadEvent braiiiiiiinz) {
    RandomEvent original = (RandomEvent) braiiiiiiinz.event;
    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(original.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) Subscribe(com.squareup.otto.Subscribe)

Aggregations

NotificationManager (android.app.NotificationManager)1023 PendingIntent (android.app.PendingIntent)416 Intent (android.content.Intent)413 Notification (android.app.Notification)290 NotificationCompat (android.support.v4.app.NotificationCompat)270 NotificationChannel (android.app.NotificationChannel)174 Uri (android.net.Uri)67 Context (android.content.Context)65 SharedPreferences (android.content.SharedPreferences)43 Resources (android.content.res.Resources)42 Bitmap (android.graphics.Bitmap)41 Bundle (android.os.Bundle)37 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)35 SuppressLint (android.annotation.SuppressLint)34 TargetApi (android.annotation.TargetApi)33 StatusBarNotification (android.service.notification.StatusBarNotification)28 TaskStackBuilder (android.app.TaskStackBuilder)26 NotificationCompat (androidx.core.app.NotificationCompat)23 IOException (java.io.IOException)23 File (java.io.File)19