当前位置: 首页>>代码示例>>Java>>正文


Java NotificationCompat.PRIORITY_HIGH属性代码示例

本文整理汇总了Java中android.support.v4.app.NotificationCompat.PRIORITY_HIGH属性的典型用法代码示例。如果您正苦于以下问题:Java NotificationCompat.PRIORITY_HIGH属性的具体用法?Java NotificationCompat.PRIORITY_HIGH怎么用?Java NotificationCompat.PRIORITY_HIGH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.support.v4.app.NotificationCompat的用法示例。


在下文中一共展示了NotificationCompat.PRIORITY_HIGH属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOptInNotification

private void createOptInNotification(boolean highPriority) {
    PendingIntent pendingIntent = createOptInIntent();

    int priority = highPriority ? NotificationCompat.PRIORITY_HIGH
            : NotificationCompat.PRIORITY_MIN;

    // Get values to display.
    Resources resources = mContext.getResources();
    String title = resources.getString(R.string.physical_web_optin_notification_title);
    String text = resources.getString(R.string.physical_web_optin_notification_text);
    Bitmap largeIcon = BitmapFactory.decodeResource(resources, R.mipmap.app_icon);

    // Create the notification.
    Notification notification = new NotificationCompat.Builder(mContext)
            .setLargeIcon(largeIcon)
            .setSmallIcon(R.drawable.ic_physical_web_notification)
            .setContentTitle(title)
            .setContentText(text)
            .setContentIntent(pendingIntent)
            .setPriority(priority)
            .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
            .setAutoCancel(true)
            .setLocalOnly(true)
            .build();
    mNotificationManager.notify(NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB,
                                notification);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:27,代码来源:UrlManager.java

示例2: MessagingStyleCommsAppData

private MessagingStyleCommsAppData() {
    // Standard notification values
    // Content for API <24 (M and below) devices
    mContentTitle = "2 Messages w/ Famous McFamously";
    mContentText = "Dude! ... You know I am a Pesce-pescetarian. :P";
    mPriority = NotificationCompat.PRIORITY_HIGH;

    // Style notification values

    // For each message, you need the timestamp, in this case, we are using arbitrary ones.
    long currentTime = System.currentTimeMillis();

    mMessages = new ArrayList<>();
    mMessages.add(
            new MessagingStyle.Message(
                    "What are you doing tonight?", currentTime - 4000, "Famous"));
    mMessages.add(
            new MessagingStyle.Message(
                    "I don't know, dinner maybe?", currentTime - 3000, null));
    mMessages.add(new MessagingStyle.Message("Sounds good.", currentTime - 2000, "Famous"));
    mMessages.add(new MessagingStyle.Message("How about BBQ?", currentTime - 1000, null));
    // Last two are the newest message (2) from friend
    mMessages.add(new MessagingStyle.Message("Hey!", currentTime, "Famous"));
    mMessages.add(
            new MessagingStyle.Message(
                    "You know I am a Pesce-pescetarian. :P", currentTime, "Famous"));

    // String version of the mMessages above
    mFullConversation =
            "Famous: What are you doing tonight?\n\n"
                    + "Me: I don't know, dinner maybe?\n\n"
                    + "Famous: Sounds good.\n\n"
                    + "Me: How about BBQ?\n\n"
                    + "Famous: Hey!\n\n"
                    + "Famous: You know I am a Pesce-pescetarian. :P\n\n";

    mNumberOfNewMessages = 2;

    // Name preferred when replying to chat
    mReplayName = "Me";

    // If the phone is in "Do not disturb mode, the user will still be notified if
    // the user(s) is starred as a favorite.
    mParticipants = new ArrayList<>();
    mParticipants.add("Famous McFamously");

    // Notification channel values (for devices targeting 26 and above):
    mChannelId = "channel_messaging_1";
    // The user-visible name of the channel.
    mChannelName = "Sample Messaging";
    // The user-visible description of the channel.
    mChannelDescription = "Sample Messaging Notifications";
    mChannelImportance = NotificationManager.IMPORTANCE_MAX;
    mChannelEnableVibrate = true;
    mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
 
开发者ID:googlesamples,项目名称:android-WearAccessibilityApp,代码行数:56,代码来源:MockDatabase.java

示例3: getPriority

@Override
public int getPriority() {
    return NotificationCompat.PRIORITY_HIGH;
}
 
开发者ID:cfryan1990,项目名称:NotificationCompat,代码行数:4,代码来源:DefaultConfig.java


注:本文中的android.support.v4.app.NotificationCompat.PRIORITY_HIGH属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。