-1

I am planning to develop a wearable device and an app (IOS, android). The wearable device is paired with the app via BLE(bluetooth low energy) and will notify to the app through BLE notify characteristic when certain conditions are met. The app will then send this data to the server.

The wearable device needs to send data in real-time for about 10 seconds when certain conditions are met (for example, when the device receives a shock), which occurs about 3-10 times a day.

There is no problem when the mobile app is in the foreground, but I'm concerned whether this feature will work properly when the mobile app is in the background mode, especially after a few hours have passed since the background mode started.

I found a product called Bond Touch (https://bond-touch.com), which allows a user to send a signal to a friend's wearable device by touching the user's own wearable device paired with the smartphone. When the user touches the wearable device, it sends a signal to the paired app, which then sends a notification to the friend's app through the internet. I think the feature I want is technically possible, but according to other search results, IOS enters background mode after 15 minutes, which makes it difficult. Android can do it if the user sets it up, but there may be battery drain issues.

I'm curious if this feature can work in the background mode of the app and if it is possible without battery drain issues.

I'm in the planning state so don't have tried yet.

m10s
  • 49
  • 2
  • 5

1 Answers1

0

Sure.

On Android, just add a Foreground Service to your app process. This prevents the app process from being killed by the system.

On iOS, you can add bluetooth-central background execution mode to your info.plist since you are a BLE central. Then make sure you implement State Preservation and Restoration, which is a CoreBluetooth feature that restarts your app process in case it has been killed by the system after some inactivity, when a notification arrives. See https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html#//apple_ref/doc/uid/TP40013257-CH7-SW5 for more info.

Emil
  • 16,784
  • 2
  • 41
  • 52