本文整理汇总了Java中org.chromium.chrome.browser.notifications.NotificationManagerProxy类的典型用法代码示例。如果您正苦于以下问题:Java NotificationManagerProxy类的具体用法?Java NotificationManagerProxy怎么用?Java NotificationManagerProxy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotificationManagerProxy类属于org.chromium.chrome.browser.notifications包,在下文中一共展示了NotificationManagerProxy类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createBroadcastNotification
import org.chromium.chrome.browser.notifications.NotificationManagerProxy; //导入依赖的package包/类
/**
* Surfaces a notification to the user that the Physical Web is broadcasting.
* The notification specifies the URL that is being broadcast. It cannot be swiped away,
* but broadcasting can be terminated with the stop button on the notification.
*/
private void createBroadcastNotification(String displayUrl) {
Context context = getApplicationContext();
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(
context, 0, new Intent(STOP_SERVICE), PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManagerProxy notificationManager = new NotificationManagerProxyImpl(
(NotificationManager) getSystemService(NOTIFICATION_SERVICE));
ChromeNotificationBuilder notificationBuilder =
NotificationBuilderFactory
.createChromeNotificationBuilder(
true /* preferCompat */, ChannelDefinitions.CHANNEL_ID_BROWSER)
.setSmallIcon(R.drawable.ic_image_white_24dp)
.setContentTitle(getString(R.string.physical_web_broadcast_notification))
.setContentText(displayUrl)
.setOngoing(true)
.addAction(android.R.drawable.ic_menu_close_clear_cancel,
getString(R.string.physical_web_stop_broadcast), stopPendingIntent);
notificationManager.notify(
NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB, notificationBuilder.build());
NotificationUmaTracker.getInstance().onNotificationShown(
NotificationUmaTracker.PHYSICAL_WEB, ChannelDefinitions.CHANNEL_ID_BROWSER);
}
示例2: overrideNotificationManagerForTesting
import org.chromium.chrome.browser.notifications.NotificationManagerProxy; //导入依赖的package包/类
@VisibleForTesting
void overrideNotificationManagerForTesting(
NotificationManagerProxy notificationManager) {
mNotificationManager = notificationManager;
}
示例3: ChannelsInitializer
import org.chromium.chrome.browser.notifications.NotificationManagerProxy; //导入依赖的package包/类
public ChannelsInitializer(
NotificationManagerProxy notificationManagerProxy, Resources resources) {
mNotificationManager = notificationManagerProxy;
mResources = resources;
}
示例4: disableUrlBroadcasting
import org.chromium.chrome.browser.notifications.NotificationManagerProxy; //导入依赖的package包/类
/** Turns off URL broadcasting. */
private void disableUrlBroadcasting() {
NotificationManagerProxy notificationManager = new NotificationManagerProxyImpl(
(NotificationManager) getSystemService(NOTIFICATION_SERVICE));
notificationManager.cancel(NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB);
}