Posts

Showing posts with the label Push Notification

Can We Do Web Push Notifications In Chrome Without Using GCM/FCM?

Answer : No, it is not possible to use another push service. In Firefox, you can do it by modifying the dom.push.serverURL preference, but obviously you'd need privileged access to alter the value of the pref. There are third-party services that you can use to implement push notifications, but they will use the Web Push API under the hood (so Autopush on Firefox, GCM/FCM on Chrome). Yes. Using VAPID spec and service worker you can use web push notifications without FCM/GCM. For more information please look into below google docs. https://developers.google.com/web/fundamentals/engage-and-retain/push-notifications/how-push-works

Android: Test Push Notification Online (Google Cloud Messaging)

Answer : Found a very easy way to do this. Open http://phpfiddle.org/ Paste following php script in box. In php script set API_ACCESS_KEY, set device ids separated by coma. Press F9 or click Run. Have fun ;) <?php // API access key from Google API's Console define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); $registrationIds = array("YOUR DEVICE IDS WILL GO HERE" ); // prep the bundle $msg = array ( 'message' => 'here is a message. message', 'title' => 'This is a title. title', 'subtitle' => 'This is a subtitle. subtitle', 'tickerText' => 'Ticker text here...Ticker text here...Ticker text here', 'vibrate' => 1, 'sound' => 1 ); $fields = array ( 'registration_ids' => $registrationIds, 'data' => $msg ); $headers = array ( 'Autho...

Android Push Notifications: Icon Not Displaying In Notification, White Square Shown Instead

Answer : Cause: For 5.0 Lollipop "Notification icons must be entirely white". If we solve the white icon problem by setting target SDK to 20, our app will not target Android Lollipop, which means that we cannot use Lollipop-specific features. Solution for target Sdk 21 If you want to support Lollipop Material Icons then make transparent icons for Lollipop and the above version. Please refer following: https://design.google.com/icons/ Please look at http://developer.android.com/design/style/iconography.html, and we'll see that the white style is how notifications are meant to be displayed in Android Lollipop. In Lollipop, Google also suggests that we use a color that will be displayed behind the white notification icon. Refer Link: https://developer.android.com/about/versions/android-5.0-changes.html Wherever we want to add Colors https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html#setColor(int) Implementation of Noti...

Chrome Push Notification - How To Open URL Adress After Click?

Answer : I am guessing you are in a Service Worker context, because that's where Push Notifications are received. So you have the self object to add a event listener to, that will react to a click on the notification. self.addEventListener('notificationclick', function(event) { let url = 'https://example.com/some-path/'; event.notification.close(); // Android needs explicit close. event.waitUntil( clients.matchAll({type: 'window'}).then( windowClients => { // Check if there is already a window/tab open with the target URL for (var i = 0; i < windowClients.length; i++) { var client = windowClients[i]; // If so, just focus it. if (client.url === url && 'focus' in client) { return client.focus(); } } // If not, then open the target URL in a new window/tab. if (clients.open...