Background Location for react native - react-native

I am creating a react native app for location tracking so I wanted to know how can I work with it.
Requirements:
Start tracking location on button click.
Fetch both foreground and background location.
Fetch location even when the app is killed.
Application needs to work with latest Android Version.
Please let me know how can I complete all the above requirements with stable packages.

Related

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 automatic update from store

Hi guys I need my react native app to update it self automatically (with user consent) when new version is published to the store (both android and ios)
I need the app to download the apk or ipa and complete the update process, not using CODE PUSH or OTA,
is it possible?
The app itself can't do that.
The closest thing you can do is:
Verify app version against the version on the server (if you have a back end).
Present a button to the user which will open the app store off your platform directly at your app's page, using deep linking.
You will have to keep server and deployed app versions in sync.

How to prevent screenshot in selected screen in android and ios react native

Previously I used this package to prevent snapshot for selected screen in android and ios.
https://www.npmjs.com/package/react-native-privacy-snapshot
https://github.com/kristiansorens/react-native-flag-secure-android
But it's not maintained by the owner and not compatible with react-native version >0.60. Many example and question in the internet only show how to prevent snapshot for whole application. But I need to prevent snapshot only for selected screen.
I've tried to do with this example
https://medium.com/#jonaskuiler/creating-a-security-screen-on-ios-and-android-in-react-native-97703092e2de
But in android, it prevents whole apps. In ios, it works.
you can use nmp library, react-native-prevent-screenshot
for more confusions and a perfact understanding check this asnwer

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

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?

Enable Popups in React Native WebView

I have a react native application(using react-native 0.43.3) that uses webview to show a web page used for online banking. That site loads a popup window with the login page.
With the ReactNative WebView this popup window in not shown. In native android to enable popup window showing I found out that I need to make webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true), but couldn't found a way to set this parameter when using ReactNative WebView.
Is there a way which I can achieve this with the WebView provided with ReactNative?
A while back I needed to fork the react-native framework because there is a bug in the iOS WebView when using javaScript bridge between react-native and native (iOS and Android), after some research I came to the conclusion that I must fork the repo in order to fix it so I did.
A week ago I needed the webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(boolean) method as well, so I went ahead and added it in my fork along with view.getSettings().setSupportZoom(boolean) and view.getSettings().setSupportMultipleWindows(supports).
If you want, here is my fork.
Please keep in mind that it means that you need to build react-native for android from source, more info on the matter can be found here, it's a bit of a hustle to be honest, but in some cases it's worth it.
the fork is from react-native 0.44.0, you should also keep in mind that if you use my fork, in means you probably wont be able to update version when they do come out, so it all depends on your needs in the end, worst case scenario you could always fork my fork and merge it with the newest version.
you can fetch my fork with npm by modifying you package.json file and then running npm update react-native
"dependencies": {
//...
"react-native": "samermurad/react-native#rctWebView-legacy-fix",
//...
}
I am planning to extract the fixes and build a separate WebView component, but I am currently too busy for that :/
I hope that helps:)