-
Notifications
You must be signed in to change notification settings - Fork 61
Question: What exactly does this plugin allow me to run in the background? #3
Comments
It's mainly for notifications / alarms and the like. If you just need to be able to stay alive when the back button is pressed, I think you can listen for the "back" event and wire it up to "navigator.app.hide()" so that the app is just backgrounded rather than killed (which is the default-but-a-bit-quirky behaviour for all android apps) |
I'm getting |
Hi @agrieve & @MoPHL I'm trying to integrate this plugin in ionic2, but bevore there are some other questions. Is this plugin like a android service? So can this run in background with closed APP and do something, like pulling a service? |
Hi @mburger81 I have not used this plugin with ionic 2, so I cannot confirm it's fully compatible. |
Hi @MoPHL, thx for your answer. So I need something like a Android Service, which is always alive, also on reboot, which has an websocket connection to server. |
@mburger81 unfortunately there are limitations to when you can run javascript code during some lifecyle phases of the application. There are some comercial solutions for push notifications on hybrid apps (ionic push, etc.), but I have only implemented one myself as a part of a native app. |
@MoPHL okay, I know the commercial solutions for push notifications, but for those services server and also mobile phone must be ONLINE, something we can not to guarantee. So we need a OFFLINE solutions, direct connection from server to mobile phone, our server is a WLAN ROUTER, so the phone connects to this router which sends notification to phone. But the problem is, what if the app is not open? For that we need a background service. You wrote, "I have only implemented one myself as a part of a native app", to you intend you implement a push notification server as GCM or ANPS or ionic push? Or you intend you did something own? You also wrote "you could easily write a service", do you intend with this cordova-plugin?? Like this example? https://github.com/MobileChromeApps/cordova-plugin-background-app/tree/master/example-app |
@mburger81 I don't understand what you mean by "we need a OFFLINE solutions", you cannot receive push notifications without network access, even if it is just a local network. |
@MoPHL, okay sorry, with OFFLINE I intend no INTERNET so no access to some push notification server as GCM in the CLOUD. I need the same thing as you described, "custom push notification service that connected to a socket on a remote server". |
@mburger81 What I meant is that you would have to implement the android service natively, cordova plugins are basically native code that talk to the nativeview. You could implement the service that deals with the push notifications natively and just have it call the webview whenever the user taps on a notification. |
Ok, I understand that. My hope was, do you have perhaps some code to share, if you already have done something like that? |
@mburger81 I do not have any code that would work for your situation as I have only done it in fully native applications. |
@MoPHL The thing is, iOS has very restrictions on background tasks. so probably there is absolutly no way to do it as we need. Probably we need always a cloud message system. |
@mburger81 do some research on how applications like google hangouts solve this issue, maybe it is possible to do the same thing they do. |
@MoPHL, google hangouts, telegram, what's app and other programs all use cloud messaging or not? |
@mburger81 I have no idea what they use, but they have push notifications, so check how they do it and if it is possible for you to do the same. |
saludos, disculpen yo estoy usando una apliucacion de ubicaciones, sera capaz de usar javascript de fondo ? y trabajar con ajax |
take a look here https://github.com/Red-Folder/bgs-core/wiki/Build-your-own-Background-Service that may help |
@mehdiar your last link doesn't exists anymore! Can you share the new one? EDIT: the url is linked wrong on clicking on it, but open the url on by copy paste TEXT it does work!! |
@MoPHL i nedd only that the app run on reboot on background to listen push notifications. and when i run the app manually, i wish that run in foreground. this plugin works?? |
I'm able to send and schedule notifications, but I'm unable to do simple web requests or logic in javascript when I press the back button on android.
So what exactly does this plugin allow, just notifications and alarms, or am I just doing something wrong?
Thanks.
The text was updated successfully, but these errors were encountered: