[Local Notifications Plugin] Notification Delay

Forge Component
(6)
Published on 17 Jan by OutSystems R&D
6 votes
Published on 17 Jan by OutSystems R&D

Hi,

I have an application that listens to Bluetooth (BLE) sensors and prompts a notification when the sensor readings exceeds a threshold. I am using the "Local Notifications" plugin to notify the user immediately. Unfortunately I ma finding that the notification is raise with a 5-15 second delay. This delay is problematic for my application as I require a maximum delay of 1 second. Is there a way to notify the user immediately?

Original I was using the vibrate plugin to notify the user but this does not work when the screen is off. 

I have set the Notifcaiton.At time to a day in the past. 

Hello Anthony,

The local notification plugin delegates the task of delivering the local notification to the operating system (Android or iOS). It is common to experience some delays, small ones when the application is in the foreground (seconds) and long ones when in the background (up to minutes). These delays should also be longer in Android 6+ (due to the introduction of doze mode) than in older versions or iOS devices.

You can possibly mitigate some issues by fiddling with the device settings, such as power saving mode and optimize battery usage. But unless you can manage all the devices that will run the app, you have no guarantee that the devices will have the same settings as your test devices.

Either way I don't think you can guarantee a 1 second warning window when the device is in the background (at least in Android). You should probably look for another alternative, such as preventing the device from going to sleep.

More information on Android doze mode: https://developer.android.com/training/monitoring-device-state/doze-standby