Our team is faced with a delimma where we need to at app-run time, detect (and then make an action) when a mobile device connection is made with Firebase. Our app needs to store value locally to SQL Lite when offline, and then push these cached values back up to the realtime-database in Firebase when the connection is restored. Presently this re-connection to Firebase is only happening with our App is shutdown and restarted.
It seems that (at least with typescript) everything is governed by the app.component.ts file. Is there a way to force the '.info/connected' to be true when the device network connection comes back .. and do this while our app is still running (memory on the mobile)?
Related
I have a question regarding Electron, since I have very limited understanding of the framework.
So what am I trying to achieve:
I am developing some sort of extension for an existing electron app, that exposes no API for my use case. The plan is to react on certain events that occure in the electron app. Those events are retrieved and transmitted via network. So my idea is to analyze the network traffic and wait for the relevant payloads.
Nearly everything is transmitted via TLS, why I am starting the electron app with environment variable "SSLKEYLOGFILE". That causes the app to write it's tls secrets into a file which can be analyzed by Wireshark. This works to some extend. I am able to decrypt a good portion of the traffic.
But there are also streams that originate from the electron app that cannot be decrypted because the secrets are not written to the log file. These streams also ignore when I start the app with "--proxy-server". So I suspect there is some kind of isolated part in the application that does not apply the provided configuration supplied to electron wrapper.
Do you have any hints for me how I can further investigate on this topic?
I am working on a mobile game, where I would like to know if the player has internet connection or not.
I tried doing it with the following methods:
Unity's internetReachability property, but it doesn't work, since - as they wrote out in the docs too - it doesn't actually detect if the player has internet connection
Pinging a website that is on 24/7 (e.g Google), but it is bad since if there are thousands of users, it will load Google servers
Now I'm trying to get a result by retrieving data from my Firebase database every X secs, and if it doesn't load, there is no connetction: the problem is, even if there is no internet connection, it doesn't crash/give any error
Is there a way I can achieve what I want with Firebase?
Please note that if the player has no internet connection, they should not be able to click on any of the game functions, because it will cause bugs, so I would like to check for connection continuously. When there is no connection I disable the GUI so that the player can not cause bugs)
If you're using the Firebase Realtime Database, it has a built-in mechanism to show you when the app is connected to the database servers. By listening to the .info/connected node, you can detect this state and update your UI.
Note that this is not just detecting an internet connection, but whether the app is connected to the database backend. So in cases where the user may have an internet connection, but can't connect to the database backend, the flag may be false.
I've created an electronjs app with pouchdb. The intent of this desktop app is to work within a wireless network of tablet application that share the same data that is pretty much blocked from the internet 95% of the time (hence the pouchdb implementation). In order for the tablet applications to sync with the desktop app, they need to be aware of how to connect to the desktop app within the network. My initial thought would be to broadcast the IP address of the electron js app in order to share data within pouchdb, but I'm not sure if it's possible. I am also thinking that I'll could install couchdb as a separate instance on the network, but would like to keep set up as simple as possible. Any ideas on how I can set this up with electron js and pouchdb?
You might be able to achieve the desired result using the Multicast DNS discovery service with Node. With mDNS, you can query the local network for other devices broadcasting on a specific namespace (e.g. 'myappid.local') which the application could query the network for.
multicast-dns is a module capable of querying the network for other devices broadcasting under a name and getting their local IP address.
After establishing a connection to other application instances on the same network, you could try replicating the database over that connection. A PouchDB plugin might be required for getting this data from Electron's main process to the renderer.
A question about registering BLE notification on android:
I am developing an app that once the android device detects our beacon/ble hardware, should write something to one of the writable characteristics of that hardware.
Trying to understand, on the android app side how can I register some intent to be called when a ble connection was made to the android framework.
since a broadcast receiver registered in manifest can no longer launch my app and android background services policy was changed, this can't be done. so..
I am trying to use JobScheduler which was designed to be launched based on criteria. this can launch a JobService to do the job.
When the app is in foreground or background this seems to be working.
The thing is, I need to be notified when the app is not running (Not even in background)
I am working with a Meteor mobile application with Cordova and PhoneGap.
My app is working fine over a Wi-Fi connection. But whenever I use it on mobile networks, 2G or 3G, it stops working. Meteor.status() returns disconnected all time on mobile cellular networks.
What is the solution for this problem?
This could occur if you have a bad connection. The Meteor in the device's browser can't really tell what network it's on. It just uses whatever it gets.
As soon as it can get a connection back it should reconnect. Keep in mind with 2G (EDGE/GPRS) connections you might have to wait a bit longer for the HTML/JavaScript to connect to the DDP server as all the client HTML/JavaScript data needs to be downloaded first. This can take quite a while.
The other thing is to ensure your (3G) connection isn't over some kind of proxy, especially if you're hosting the application yourself on an unusual port number (websockets usually fall back to long polling, though).