Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to test Onesignal push notifications on localhost?

I want to test OneSignal push notifications on localhost before I deploy my app to a remote server.

I followed the instructions provided by the documentation. When I enter http://localhost as the site url I get an error message that says:

localhost is already taken. Please enter a different name.

Is there a way to use OneSignal on localhost ?

like image 726
Abdelaziz Mokhnache Avatar asked Oct 03 '17 10:10

Abdelaziz Mokhnache


People also ask

How do I test my OneSignal push notifications?

Install Your SDK Copy the alpha numeric code that OneSignal generates called Your App ID in the image below. On Thunkable, open the Push Notifications dialog and paste this ID into the Android App ID field. Click the Live Test button. Once the app is on your phone, go back to One Signal.

What is test push notification?

It allows you to have a small group of test users on both Android and iOS to send your test notification out to without bugging the other users of your app. Using Notification Groups allows you to test more targeted notifications.


3 Answers

Besides configuring OneSignal via dashboard, your OneSignal.init in your browser call must have the allowLocalhostAsSecureOrigin option:

OneSignal.init({
  allowLocalhostAsSecureOrigin: true,
  ...
})

More at https://documentation.onesignal.com/docs/web-push-setup-faq#section-how-do-i-test-my-site-on-a-local-environment

like image 34
Tomás Lima Avatar answered Sep 28 '22 09:09

Tomás Lima


read in this doc https://documentation.onesignal.com/docs/web-push-setup-faq#section-how-do-i-test-my-site-on-a-local-environment- and localhost must run in port 8000

like image 41
Muhammad Rosyid Avatar answered Sep 28 '22 08:09

Muhammad Rosyid


It should be https://localhost not http://localhost. OneSignal treats localhost as secure connections.

like image 136
Abdelaziz Mokhnache Avatar answered Sep 28 '22 08:09

Abdelaziz Mokhnache