2
votes

First i will explain what i want to achieve. I have a BLE lock. i want that my application will wake up from kill state and start scanning BLE device. Once the BLE device found it will connect with my phone and get unlock.

All this is working in background mode and i tested this many times. but i also want this to be work when app is in kill state.

I tried several things. First I tried Geofencing but in case of geofencing app wake up for less time i'm not properly scan the BLE device. When didEnterRegion region: called i sent the local notification and it was working fine. So after that i tried to scan BLE Devices when didEnterRegion region: and also get the notification that scan is started but i think after some time app remove from the background automatically and could not relaunch. So that's why i'm failed to discovered any BLE device.

I also read apple document for Core BlueTooth: https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html

There is mention that how to perform long task like open and close door lock but isn't help me.

Please guide me how to do this when app is in kill state.

Thanks for the help :)

UPDATE: What i mean from kill state is suspended/ terminated/removed from background. I just want that once user get enter into the region of geofence then app launch in background and scanning for the BLE device started. so after that i want app will stay into the background until door get unlock.

1
What do you mean by "kill state"? Do you mean that the app has been killed by the user or never launched in the first place?Youssif Saeed
@YoussifSaeed What i mean from kill state is suspended/ terminated/removed from background. Yes user can remove the app from background. i just want that once scanning started, once user get enter into the region of geofence then app will stay into the background until door get unlock.Sourav Mishra
If the use has killed your app then they must relaunch it for it to operate. For other scenarios refer to Core Bluetooth state restorationPaulw11
@Paulw1 How we can relaunch the app if user remove it from background. I don't have much knowledge about Core Bluetooth state restoration. What i know if user forcefully terminate the app i.e remove from background then BLE event cannot relaunch the app. Can you help me in that. If device come under BLE single then app automatically relaunch and start scanning the BLE LOCK and then connect with the lock. is this possible?Sourav Mishra
No, if the user kills the app by swiping up then they will need to relaunch it themselves to open the lock.Paulw11

1 Answers

2
votes

As Paulw11 mentioned, there's no way to relaunch an app in the background once it is terminated/killed by the user. Apple have done this deliberately for security and functionality reasons: if a user deliberately kills an app because it is buggy/faulty, the app should not be able to relaunch itself.

More information can be found here:-

I hope this helps.