Nickersoft / push.js

The world's most versatile desktop notifications framework :earth_americas:
https://pushjs.org
MIT License
8.76k stars 548 forks source link

Doesnt work on android #96

Closed TheGuy68 closed 5 years ago

TheGuy68 commented 7 years ago

I've just used the code that is posted in the main example and it doesn't work when I try to use it from my chrome browser. I'm running it on a local node server and it works fine on the computer. What really confuses me is that the "Demo button" on the https://nickersoft.github.io/push.js/ works fine. Any ideas on what might be going on?

Nickersoft commented 7 years ago

Hm, how are you using Push? NPM install I take it? What is the path Push is stored in vs the path it is being called from? This might be related to the Service Worker path problem seen in #87, which is a very high priority issue I need to look into. I should probably create a formal issue for it.

TheGuy68 commented 7 years ago

hi there. i did an npm install but i just copied the push.min.js to a js folder in my public folder as there was no examples showing me how to use the npm version of the plugin. Best things i found was a video on youtube. That just used the min.js version. If you could provide an example of how to include it from node_modules in my html file that would be great and ill try it and let you know. But according to what I've its a fantastic little lib. Simple and does the job great from the demo page.

roelvan commented 7 years ago

Same problem here. Used npm and then import Push from 'push.js'

loren138 commented 7 years ago

I moved the script import into the body of my site from the head and then it worked.

d3o commented 7 years ago

Same problem. Decktop work fine, but Android not.

Installation over http not https:

    <script src="resources/js/serviceWorker.min.js"></script>
<script src="/resources/js/push.min.js"></script>

Push:

Push.create("Title", { serviceWorker: './resources/js/serviceWorker.min.js', body: message, icon: './resources/images/logo-ojo.png', timeout: 4000, onClick: function () { window.focus(); this.close(); } });

lovato commented 6 years ago

Any updates on this one? I am facing the exact same problem...

lovato commented 6 years ago

This solved the problem... But is too much code to do it. And inspecting pushjs website, I have no idea how it works on mobile.

https://github.com/Nickersoft/push.js/issues/118#issuecomment-422340804

theLufenk commented 5 years ago

@lovato you do not need to write all that code. Push.js has support for specifying your own service worker( Refer Documentation ) In case the serviceWorker config option is not provided, it will expect a serviceWorker.min.js file to be present at the root of your domain. If you do not wish to write your own serviceWorker, you can use the provided ServiceWorker file.

Are you sure you are testing over https ? Chrome now requires a website to be running in a secure context in order to use Notifications. The only exception to this is when you are testing on 'localhost', which might explain the behaviour experienced by @TheGuy68 in the original issue statement.

lovato commented 5 years ago

Thanks. Will get back into this.