Enabling MQTT Service in Background in Hybrid Applications for iOS environment - ios

I'm using MobileFirst Platform 7.1 with Paho MQTT (Internet of Things), I'm trying to implement a Hybrid Application with mqtt for Android and iOS.
I have tested the app in Android and it is working as expected, when it is in the foreground and background,
While in iOS, it does not work as expected. It works correctly in the foreground, but not in the background. I was testing using the iPhone Simulator of XCode and iPhone 6.
I found a project which implemented with MobileFirst and MQTT. from https://developer.ibm.com/mobilefirstplatform/documentation/integration/mq-telemetry-transport/
i am just adding host and port number and adding android,ios environment.but same problem facing android working iOS not.
at this moment what can i do ?
UPDATE:
in iOS, it works correctly foreground.but when i send background the "MQTT client" connection lost form broker.
this method fire :
this.client.onConnectionLost = function() {
alert("Connection lost!");
};
on the other hand , android , windows it work perfectly for foreground and background
For example :
I have a room there have a PIR sensor. it work like publisher . my application user is a subscriber .
when user out the room that that time she open application,subscribe and
send application background.
anytime someone entire the room that time , she will be get a notification.

Details on how to run in the background on iOS can be found here. This link also lists the actions that Apple allows to run in the background, if your app does not meet those criteria then it is likely to get bumped from the app store.
The list also shows which UIBackgroundModes to place in your Info.plist to flag that your app needs background access.

I can not found at least one way to mange it for hybrid application ,tried with several way ,failed and mange it easily for native application MQTT iOS background.
Todos
Plan support for new platforms (iOS, Windows Phone)
Add background service support in Android version
more check this link https://github.com/arcoirislabs/cordova-plugin-mqtt

Related

IoT device that use iPhone as Gateway

I'm developing an IoT device that will connect to iOS via Bluetooth.
I've seen some smartwatches that uses the iPhone as a gateway to perform Internet connection tasks like getting weather data, without the need to open a particular app.
How can this be achieved?
Is there any supported Bluetooth Profile that iOS support for that functionality?
There is a way to allow you to listen to Bluetooth activities in the background as well. Check out this documentation.
And, for the part about running tasks without the app running in the foreground, you might want to check out the background execution API (Only in iOS 13)

Link iOS push notification to PWA/website

We are in the process of developing a PWA that should send out notifications that are visible outside the application and even when the application is closed. In other words, like when a native app would send out notifications.
However, at the moment this is only possible on Android devices, on iOS this is not yet possible.
So we are looking for ways to work around this problem.
One theory is to create a very small native app for iOS with the soul purpose to send out notifications.
Our PWA would create the notification and make it available via an API call.
The native app would do a request every x seconds to retrieve the notifications and display them on the phone.
The part where we are a bit in the dark about is if it is possible to make the notification that is displayed link to the PWA instead of the native app?
Yes maybe with OS X Push Notifications for Websites: https://developer.apple.com/notifications/safari-push-notifications/

TokBox iOS - App Background process singal not working

We are facing some strange issue in the iOS app , we are handling the signal when app in background mode.
It's perfectly working in xcode simulator and the same thing it's not working in real iOS devices. The signals not receiving in app background mode.
Do we need to enable any settings in iOS devices to handle this?
And, It's perfectly working in android devices.
Please help on this.
(Also Project->Capabilities-> Background Modes -> Audio,AirPlay,PIP is enabled for this to work in background.)
Apps sent to the background are generally expected to get suspended unless there is a reason for the process to stay running. In the case of using the OpenTok SDK, usually this means the app will be suspended unless there is a Publisher and/or Subscriber running -- background permission is tied to the AVAudioSession.
If you are trying to just keep a session connected without any subscribers/publishers while the app is in the background, this is not a recommended implementation. Keeping a websocket active for an OpenTok session requires trickling data every few seconds, creating an unnecessary burden on energy and data costs. For this reason, it is recommended to do your offline signaling via APNS rather than through an OpenTok session.
I trust you may have already seen this, but just for completeness, a more in-depth writeup on the topic is available here: https://tokbox.com/developer/sdks/ios/background-state.html
Disclosure: I work for TokBox.

cordova plugins bluetooth background service

I'm currently trying to make an IOS app with cordova. While reading the doc for bluetooth I was wondering if it was possible to have the cordova plugins to handle the "Reinstantiate Your Central and Peripheral Managers" part.
Since that part should not required to bring the app foreground to interact with the bluetooth device, will the plugin will be able to wake up ? or will the cordova part must be wake up to ?
Is there a way to simplify the implementation ?
I'm kind of new with the bluetooth technology and I don't have much knowledge with cordova plugin. I'm still currently trying to make it work but I would like to know if it is possible.
For now I'm doing the app like so:
cordova will handle the interface to setup the data and settings and the plugins will handle all the interactions with the bluetooth device. I'm trying to make the plugins, the part that will be restored when a know bluetooth device is connected (in the hope it do so even when the phone is locked) and make it handle the data transfert without the app being put in the foreground or even lunched in the background (I would like to have only the plugins part to be wake up)

iOS refresh bluetooth characteristics

I have created an iOS app that interacts with a bootloader on some custom hardware/firmware to update the application on the hardware. In order to accomplish this, the hardware/firmware has a bootloader application and a regular application. First, I connect my iOS app to the bootloader application and update the regular application. At which point the regular application starts to run and I would like to connect to it with my iOS app.
If I search for peripherals with an Android application it correctly sees my hardware broadcasting as the bootloader application and then switch to broadcasting as the regular application after the update has been completed. However, for some reason, the equivalent iOS app only sees it being broadcast as the bootloader application. I have found that if I restart the iOS device or if I turn the iOS device's bluetooth off and back on after a few seconds it will finally recognize that the regular application is broadcasting.
It seems as though the iOS device is caching the peripheral information. Does anyone know if there is a way to clear the cache or refresh to get the current/valid status of the device?
I have exactly the same issue here, unfortunately this is indeed due to iOS. There are a lot of other threads about this topic but after looking for a while I would recommend this answer :
https://stackoverflow.com/a/25930825
Best of luck, I haven't finished yet and this won't be easy...

Resources