Hi. Huge thanks for kable library, works perfectly...
# juul-libraries
g
Hi. Huge thanks for kable library, works perfectly 📌 probably unrelated but not sure where else to ask. There is a ble device which iOS connects to it and they both communicate. Some events from ble device are important and should be sent to server. The issue is that when app goes to background then it has no internet at all. Did you guys had to send http requests to server when app is in background? There is not much docs about this. I was able to find some posts on stackoverflow but all of them talk on very high level, for example this https://stackoverflow.com/questions/63016680/sending-network-request-after-bluetooth-update-while-ios-app-is-in-background It seems to be possible but for 1 week I have almost no progress. Any ideas? or maybe you guys have some sample code?
t
I haven't personally worked with iOS app being backgrounded while needing to download files so I don't have any pre-written code to share, nor know if the follow will work, but based on the Stackoverflow you linked, perhaps you could try creating a
NSURLSession
that is configured for background. Then use it with Ktor via the `DarwinClientEngineConfig`'s
usePreconfiguredSession
method?: https://api.ktor.io/ktor-client/ktor-client-darwin/io.ktor.client.engine.darwin/-darwin-client-engine-config/use-preconfigured-session.html
g
thanks for reply. now it is asking me to create a file with data to upload. Seems like there should be one more endpoint for file uploading on the server. This all seems overkill. To save 3-4 line json text in a file and ask iOS to upload... idk. On Android foreground notification is enough and all is working