0

i am developing react natuve application for over 2 years now and have some experiance with IOS development. So after searching the web for possible ble libraries for react native i didn't find a library that does what i need...

So i decided to give it a shot and write some native code.

My goal is to create an application that act as ble peripheral while the application is in the foreground/background

I went into some research on how it should be done on IOS, the limitation and etc. And than I looked into some tutorials on this subject and managed to create an application that act as peripheral while in the foreground but as soon as i move the application to the background the application stop the ble transmission.

I tried to work with IOS background task but again with no luck.

I am surely missing something...

Can i write a code that act as peripheral while app in background ?

update:

This is my startAdvertising function:

 peripheralManager.startAdvertising([CBAdvertisementDataLocalNameKey : "CoolBleApp", CBAdvertisementDataServiceUUIDsKey : [serviceUUID]])

Also is it possible to send serviceData in IOS?

Nissan
  • 1
  • 1
  • Yes, you can. An iOS device acting as a peripheral in the background can be discovered by other iOS devices. Can you edit your question to show the relevant code? Have you added the "acts as a Bluetooth peripheral" background mode capability to your app? – Paulw11 Apr 20 '20 at 21:38
  • This is my advertisement function : func startAdvertising() { peripheralManager.startAdvertising([CBAdvertisementDataLocalNameKey : "BLEPeripheralApp", CBAdvertisementDataServiceUUIDsKey : [service]]) print("Started Advertising") } and yes i added the capability – Nissan Apr 21 '20 at 05:48
  • 1
    It is better to edit your question to include code rather than adding code in a comment. How are you scanning for your service when your app is in the background? Are you using another iOS device? – Paulw11 Apr 21 '20 at 07:23
  • Yes i am trying to scan with another ios device that sopose to act as peripheral and central while in the background as well – Nissan May 13 '20 at 14:26
  • And what is your scanning code on the central side? You need to show more code. What you are trying to do is possible, so if it isn't working you have a problem in your code. If you don't show your code it is impossible to help – Paulw11 May 13 '20 at 20:55

0 Answers0