Background timer with Expo - react-native

Need to get the timer going even if the app is running in backgroung.
Trying to use react-native-background-timer library to do so, but getting this error:
undefined is not an object (evaluating 'RNBackgroundTimer.setTimeout)
On some research got to know that I will have to eject expo to be able to use this.
Is there a way to do this with expo?

Yes actually within Expo itself you can use their Background Fetch API to handle all background tasks, it uses TaskManager under the hood to do that. You don't need to use react-native-background-timer.
Further details of this API and application is found here.
Hope this Helps!

Related

REACT NATIVE - Expo AV didJustFinish

I'm currently working on an application in React Native. I need to be able to read and manage audios for my project.
I find the documentation for Expo AV rather badly done, there is a lack of examples of use.
To make it simple, I want to get the didJustFinish value (boolean). To do so, I created a loop using setOnPlaybackStatusUpdate but I don't understand how to get the didJustFinish value back afterwards.
Okay, I found the solution.
Here's an example:
yourSoundObject.setOnPlaybackStatusUpdate((playbackStatus) => {
console.log(playbackStatus.didJustFinish)
console.log(playbackStatus.positionMillis)
})
playbackStatus is a property that is only added in the function called by setOnPlaybackStatusUpdate.
For ease of use I've done this in an anonymous function

Recording Crash using Crashlytics AFTER overridin JSExceptionHandler (React Native)_

I'm using Crashlytics (Natively) in React Native.
In RN, I'm overriding the JSExceptionHandler to use NativeModules and call out to my MyCrashHandler.
MyCrashHandler does the with Crashlytics reportError.. but this is only good if I THEN have a crash.
I can't have a Crashlytics crash because I already overrode the JSExceptionHandler.
How do I force Crashlytics to send my events? Maybe I need to use Firebase logging instead?
You don't have to wait for a crash to know that Crashlytics is working. You can use the SDK to force a crash by adding the following code to your app
Button crashButton = new Button(this);
crashButton.setText("Crash!");
Also, you can use your own API like this:
Fabric.with([Crashlytics.start(withAPIKey: "YOUR_API_KEY")]
You can write your own custom crash report by writing code in native iOS and Android. Please check the following the link for it.
https://firebase.google.com/docs/crashlytics/customize-crash-reports?platform=ios

React native turn by turn navigation

we working with expo and using mapview, however, there are many restrictions in react native maps, as we are planning to implement turn by turn navigation. Integrating Mapbox would have been the best option, however we do not think it’s best to eject the project as expo doesn’t still support Mapbox. Although, I came across a package, react native maps navigation, I would like to know if anyone has been able to successfully implement it in their project and it functioned properly, and also know if there are any drawbacks that comes along with it. I am asking this because the author says “Please note that this module is usable but still under heavy development. Some properties and/or component names might change without notice.”
Kindly give your suggestions and advice. Thanks
Mapbox works very well in a react-native projects and recommend to use this service for your project but effectively, it don't works with expo so for me, you should eject your project to use it.
I paste here some packages I used for a GPS project (The last one is to get the current position of an user)
react-native-mapbox-gl/maps
mapbox-sdk
react-native-geolocation
Hope that could help you

How to resolve Undefined is not an object (evaluating 'RCTToastAndroid.TOAST')

I want to run a react-native app. Before, it runs normally. An then when I add a sound and I run it again it show Undefined is not an object (evaluating 'RCTToastAndroid.SHORT')
I already open another stackoverflow question like this but it not resolve my problem
Looking at the error, even without any code from you, I have some assumptions.
You are probably trying to implement Android Toast in your app.
In the react-native docs there is an example of how to do it here and you are getting an error because of it.
Please Provide the full code where you are implementing it so we can get an proper solution.
By what you posted in your answer, there is some error in implementing Android's Toast.
OR
You have the Toast module implemented correctly, but your are in an IOS device and in you can't use Android's Toast in IOS.
If this is your case, you can try implementing something different to display and use react native Plataform.select to render the Toast in Android and something else in IOS.

How do you enable Core Spotlight to index app content in React Native

What's the easiest way to go about indexing a React Native app so that content within the app appears in Spotlight searches?
If you're still interested in indexing your app content using React Native, I've written a plugin to do just that.
As you've figured out, there's no built-in react-native support for this. The only option for you to utilize the Core Spotlight framework capabilities is to create your own native module which will expose this functionality to your react-native code. You can also try to find someone who already wrote this module and made it open source, but I guess you've already tried that.
Since this is the only way, it is also the easiest... That said, it should be pretty easy to implement it yourself, assuming you have some experience with iOS development. If you run into problems you can post your code and I can point you in the right direction if necessary.