org.chromium.chrome.browser.notifications.NotificationManagerProxy Java Examples

The following examples show how to use org.chromium.chrome.browser.notifications.NotificationManagerProxy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PhysicalWebBroadcastService.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #2
Source File: UrlManager.java    From delion with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
void overrideNotificationManagerForTesting(
        NotificationManagerProxy notificationManager) {
    mNotificationManager = notificationManager;
}
 
Example #3
Source File: UrlManager.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
void overrideNotificationManagerForTesting(
        NotificationManagerProxy notificationManager) {
    mNotificationManager = notificationManager;
}
 
Example #4
Source File: ChannelsInitializer.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public ChannelsInitializer(
        NotificationManagerProxy notificationManagerProxy, Resources resources) {
    mNotificationManager = notificationManagerProxy;
    mResources = resources;
}
 
Example #5
Source File: PhysicalWebBroadcastService.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/** Turns off URL broadcasting. */
private void disableUrlBroadcasting() {
    NotificationManagerProxy notificationManager = new NotificationManagerProxyImpl(
            (NotificationManager) getSystemService(NOTIFICATION_SERVICE));
    notificationManager.cancel(NotificationConstants.NOTIFICATION_ID_PHYSICAL_WEB);
}