Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Doesnt work on android #96

Closed
TheGuy68 opened this issue Feb 28, 2017 · 9 comments
Closed

Doesnt work on android #96

TheGuy68 opened this issue Feb 28, 2017 · 9 comments

Comments

@TheGuy68
Copy link

TheGuy68 commented Feb 28, 2017

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?

@TheGuy68 TheGuy68 changed the title Doesnt Doesnt work on android Feb 28, 2017
@Nickersoft
Copy link
Owner

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
Copy link
Author

TheGuy68 commented Mar 1, 2017

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
Copy link

roelvan commented Apr 13, 2017

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

@loren138
Copy link

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

@d3o
Copy link

d3o commented Sep 30, 2017

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
Copy link

lovato commented Oct 3, 2018

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

@lovato
Copy link

lovato commented Oct 3, 2018

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.

#118 (comment)

@theLufenk
Copy link
Collaborator

@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
Copy link

lovato commented Oct 31, 2018

Thanks. Will get back into this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants