How to manage ios background modes via react native (for example calling API while app is killed) - objective-c

I'm developing a react-native app and I'm facing a problem: I need to execute a periodical task (an API call to post some data) in all possible cases: the app is in the background, app is in foreground and app is killed (double tap on the home button and swipe up).
How could I achieve this in iOS?
For Android, HeadlessJS seems to work fine, but for iOS I couldn't find anything which could fit my case.
I've tried with react-native-background-fetch but if the app is killed, also the background fetch is halted (https://github.com/transistorsoft/react-native-background-fetch/issues/34)
I've tried react-native-background-timer, but it works only until the app is killed.
I've also tried adding a geolocation native library to set background mode "location updates" capability, and calling its start method inside the didFinishLaunchingWithOptions into AppDelegate.m. But also this works only until the app is killed.
If I use the same native library on a native iOS app, and I call it inside the same method into AppDelegate.m, it keeps working also when the app is killed.
So which is the difference between the native and react-native app that lets the app survive the force-quit?
I've also tried reading this https://developer.apple.com/library/archive/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html but I couldn't replicate that info via react-native.
Can someone help me, please?

Related

How to run a JS funktion before Metro replaces my React Native JS code via "Reload"

I am writing a React Native app with hardware access. This means that I setup the hardware at application startup. Then I could click "Reload" in the developer menu. But before the code is reloaded I need to tear down my hardware setup since otherwise the setup during restart fails.
Is there any way I can create some kind of callback function/hook that allows me to get informed immediately before app reload? Than I could to the tear down in this function. Please note the code has to run in the handy app (not as a kind of plugin for metro bundler).

Screenshot Lock not working in React native app on iOS devices

We want to lock screenshot on app screens in React Native app so that user is not allowed to take the screenshot. The feature is implemented successfully in android version of the same React Native app. But it is not working in iOS app which is published to app store. I have also tried react-native-prevent-screenshot plugin but that is also not locking screenshot in iOS version. I even implemented blurred view on appDelegate.m file to prevent screenshot capture in app, but even this did not have any impact. Can someone tell if Apple has banned this feature completely or there is possibility of some issue in coding. But I rule that out because it is working successfully in android apk. Please help

react native expo building javascript bundle multiple times and fail

I'm currently developing react native app and kinda new to it. Sometimes when I open my app in expo(usually using my iPhone device to debug app) it building javascript bundle multiple times very rapidly and it's unavailable to open app in my phone while the expo bundler is keep building javascript.
Indeed I need to force server to stop and restart, sometimes it works but not always.
It's not a big issue since I restart the app It's okay but why is this happening?
this is my screenshot of building javascript in expo. green one is from terminal and white one is from expo...

React Native - Native audio player on locked device screen

I'm using react-native-sound library for audio files to play inside Rn app for both iOS and Android.
I have question about locked screen, I would like to have audio player on locked screen.
Currently behaviour is different, on iOS audio stops after lock, on Android it continues.
I would like something like this:
I know this is a late answer but I just installed https://www.npmjs.com/package/react-native-music-control and using it alongside react native sound and everything works for the lock screen in ios. The audio continues to play in background when using the react native sound option:
// Enable playback in silence mode
Sound.setCategory('Playback');
If you follow the docs for both libraries it should work for ios. In the react native music control library, make sure you follow the part about setting the Background Mode in xcode. Bare in mind that in the simulator the lock screen was not showing, only when the app is on the device does it show but the audio does play in background on simulator.

ReactNative: Does `Linking.addEventListener` fire when the app is running background?(Deep linking)

When I set up like this
https://facebook.github.io/react-native/docs/linking#basic-usage
and open the app via Custom URL Scheme,
_handleOpenURL catches the URL if the app is shutdown, but doesn't if the app is running background.(iOS)
So can't I use the Linking.addEventListener when the app is already running?
I was having this issue working on a detached Expo project because I had added the suggested code from https://facebook.github.io/react-native/docs/linking.html to the *AppDelegate.m but Expo already provides slightly different functions for handling URL events. Removing the code from the React Native docs made it work for me.