Android examples for Android OS:Notification Show
show Notification With Priority
// Use of this source code is governed by the MIT license that can be found import android.app.Notification; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationManagerCompat; import android.support.v4.app.NotificationCompat.WearableExtender; import android.support.v4.app.RemoteInput; public class Main{ private static void showNotificationWithPriority(Context context, int id, int priority) { NotificationManagerCompat.from(context).notify( id,/*from w w w .j a va 2s . c o m*/ createBasicNotificationBuilder(context).setPriority( priority).build()); } private static NotificationCompat.Builder createBasicNotificationBuilder( Context context) { return new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle(context.getString(R.string.content_title)) .setContentText(context.getString(R.string.content_text)); } }