Search in sources :

Example 36 with NotificationManagerCompat

use of android.preview.support.v4.app.NotificationManagerCompat in project WordPress-Android by wordpress-mobile.

the class NativeNotificationsUtils method showMessageToUserWithBuilder.

public static void showMessageToUserWithBuilder(NotificationCompat.Builder builder, String message, boolean intermediateMessage, int pushId, Context context) {
    if (!intermediateMessage) {
        builder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
    }
    builder.setProgress(0, 0, intermediateMessage);
    NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
    notificationManager.notify(pushId, builder.build());
}
Also used : NotificationManagerCompat(android.support.v4.app.NotificationManagerCompat)

Example 37 with NotificationManagerCompat

use of android.preview.support.v4.app.NotificationManagerCompat in project WordPress-Android by wordpress-mobile.

the class NotificationDismissBroadcastReceiver method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    int notificationId = intent.getIntExtra("notificationId", 0);
    if (notificationId == GCMMessageService.GROUP_NOTIFICATION_ID) {
        GCMMessageService.clearNotifications();
    } else {
        GCMMessageService.removeNotification(notificationId);
        // Dismiss the grouped notification if a user dismisses all notifications from a wear device
        if (!GCMMessageService.hasNotifications()) {
            NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
            notificationManager.cancel(GCMMessageService.GROUP_NOTIFICATION_ID);
        }
    }
}
Also used : NotificationManagerCompat(android.support.v4.app.NotificationManagerCompat)

Example 38 with NotificationManagerCompat

use of android.preview.support.v4.app.NotificationManagerCompat in project wh-app-android by WhiteHouse.

the class NotificationPublisher method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    final NotificationManagerCompat nm = NotificationManagerCompat.from(context);
    final Notification n = intent.getParcelableExtra(EXTRA_NOTIFICATION);
    final int id = intent.getIntExtra(EXTRA_NOTIFICATION_ID, 0);
    nm.notify(id, n);
}
Also used : NotificationManagerCompat(android.support.v4.app.NotificationManagerCompat) Notification(android.app.Notification)

Example 39 with NotificationManagerCompat

use of android.preview.support.v4.app.NotificationManagerCompat in project wh-app-android by WhiteHouse.

the class LiveService method postLiveItem.

private void postLiveItem(final FeedItem item) {
    final Notification notification = buildLiveNotification(item);
    final NotificationManagerCompat nm = NotificationManagerCompat.from(this);
    nm.notify(0, notification);
}
Also used : NotificationManagerCompat(android.support.v4.app.NotificationManagerCompat) Notification(android.app.Notification)

Aggregations

NotificationManagerCompat (android.support.v4.app.NotificationManagerCompat)38 NotificationCompat (android.support.v4.app.NotificationCompat)17 PendingIntent (android.app.PendingIntent)15 Intent (android.content.Intent)15 SharedPreferences (android.content.SharedPreferences)7 PowerManager (android.os.PowerManager)7 Bitmap (android.graphics.Bitmap)6 AppSettings (com.klinker.android.twitter.settings.AppSettings)6 Notification (android.app.Notification)5 Context (android.content.Context)4 Cursor (android.database.Cursor)4 RemoteInput (android.support.v4.app.RemoteInput)4 Bundle (android.os.Bundle)3 ComponentName (android.content.ComponentName)2 ContentResolver (android.content.ContentResolver)2 ContentValues (android.content.ContentValues)2 Uri (android.net.Uri)2 Builder (android.support.v4.app.NotificationCompat.Builder)2 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)2 ArrayList (java.util.ArrayList)2