本文整理匯總了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);
}