Тёмный

Get started with Background Geolocation in React Native 

Jonas Grøndahl
Подписаться 3,4 тыс.
Просмотров 50 тыс.
50% 1

In this video you'll learn how to do (background) geolocation in React Native. These are the parts I'll show:
- The 2 libraries available
- How to get started with my preferred choice
- How to rewrite example into functional component (hook)
- How to implement location tracking, history and distance
- How to work with the simulator to simulate movement using an existing app I built
Links to resources:
Article: everyday.codes/tutorials/how-...
Library 1: github.com/mauron85/react-nat...
Library 2: github.com/transistorsoft/rea...
Gist to hook:
gist.github.com/jonasgroendah...

Опубликовано:

 

9 май 2020

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 47   
@bilelrahmouni01
@bilelrahmouni01 2 года назад
thank you !!
@clarissacarcha8078
@clarissacarcha8078 3 года назад
Hi nice tutorial, how do you handle stationary? thank you!
@peymanhakemifar3671
@peymanhakemifar3671 3 года назад
thanks for this code. but i use it and im not giving any logs in my console nothing. should i move to see logs or standing is ok? what should i do to work and give me the location?
@minalchhetri3878
@minalchhetri3878 2 года назад
Sir , Is it works for ios for backgrond geolocation ? In my case it work properly both in background and foreground , but in ios it works for foreground geolocation only?
@jeancarbone2740
@jeancarbone2740 2 года назад
Great job! could you share the useInterval hook?
@lglf77
@lglf77 4 года назад
Is it difficult to start and end a map delivery and call API?
@victorgalvez1486
@victorgalvez1486 2 года назад
Hi Jonas, thanks for the tutorial. The resource (first link) it's dont found
@olegs77
@olegs77 4 года назад
Great job Jonas! What simulator do you use in VScode? i'm building a project in which employees be able to check in and check out on workplace only in particular geolocation.
@jonasgroendahl
@jonasgroendahl 4 года назад
Олег Smushkevitz this is the iOS simulator that comes with XCode (MacOS) 🙂
@olegs77
@olegs77 4 года назад
@@jonasgroendahl wow! And for Android environment is there such a beauty?
@jonasgroendahl
@jonasgroendahl 4 года назад
@@olegs77 Yes! Open Android Studio->AVD Manager and start the emulator from there. If you're doing React Native development, you should be able to simply launch by running react native run-android though
@olegs77
@olegs77 4 года назад
@@jonasgroendahl I'm using emulator but its only emulates the real device. There is no way simulate movements of object and see position changing...
@FinnTaylor007
@FinnTaylor007 2 года назад
Hi Oleg, I am trying to build the exact same thing. Have you succeeded with your project?
@lglf77
@lglf77 4 года назад
Are there paid lessons with voice translator for subtitles about this map article in React Native?
@prasantarout8843
@prasantarout8843 2 года назад
Hello sir can you please share the full code of this tutorial..you have running a timer with distance at same way i want to do this my project..please help me..
@RumoAoTopo332
@RumoAoTopo332 3 года назад
please tell me about "HOME"
@mehmetsalihakcan6851
@mehmetsalihakcan6851 4 года назад
Hi, i use react native expo ,i want to get user location every 15 minutes in background/foreground/terminate mode .This library does supported for expo ?
@jonasgroendahl
@jonasgroendahl 4 года назад
I'm not an expo expert but I believe you'll have to look into this: docs.expo.io/versions/latest/sdk/location/ :)
@Bigdog5400
@Bigdog5400 3 года назад
Did you get background location working in expo?
@tharmeekansivarasan5642
@tharmeekansivarasan5642 3 года назад
Can u provide the source code of home page u rendering
@abhishekjn3390
@abhishekjn3390 2 года назад
has to pay for release builds??
@giovannadonis7053
@giovannadonis7053 3 года назад
Did you actually manage to publish this to the public store, IoS seem to instantly reject apps if you use any kind of background trakcing?
@Bigdog5400
@Bigdog5400 3 года назад
I believe you have to update your p-list as to why you are tracking background location. If it makes sense for the app and users agree, then I don't think it should be an issue
@GilbertoCortez
@GilbertoCortez 3 года назад
Can you please tell me a bit more about getDistance please. Thank you!
@jonasgroendahl
@jonasgroendahl 3 года назад
export function getDistanceFromLatLonInKm( lat1: number, lon1: number, lat2: number, lon2: number, ) { var R = 6371; // Radius of the earth in km var dLat = deg2rad(lat2 - lat1); // deg2rad below var dLon = deg2rad(lon2 - lon1); var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2); var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); var d = R * c; // Distance in km return d; } // from stackoverflow
@secretdoor7972
@secretdoor7972 3 года назад
i got build error .pls share the configuring steps
@hardikchaturvedi8036
@hardikchaturvedi8036 4 года назад
please tell me about "defaultLocation" from file "../utils/var"
@jonasgroendahl
@jonasgroendahl 4 года назад
export const defaultLocation = { latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421, };
@hardikchaturvedi8036
@hardikchaturvedi8036 4 года назад
@@jonasgroendahl thank you very much
@mosesbakst
@mosesbakst 4 года назад
Does this work with Expo?
@jasonabignale2296
@jasonabignale2296 3 года назад
Nope. You could use expo-location instead
@babynoob1942
@babynoob1942 3 года назад
Does react Native expo support geo location??? Or I need react Native CLI for geo location...
@jonasgroendahl
@jonasgroendahl 3 года назад
I believe Expo has another module for same purpose, but could be wrong
@babynoob1942
@babynoob1942 3 года назад
@@jonasgroendahl thanks man
@basilek5299
@basilek5299 3 года назад
Hi, thanks Please tell me how it work 's id app is background stage!!
@secretdoor7972
@secretdoor7972 3 года назад
i got build error .pls share the configuring steps
@basilek5299
@basilek5299 3 года назад
@@secretdoor7972 what error is showing!!
@faizansiddiqui6708
@faizansiddiqui6708 Год назад
and when gps will off
@lyseihakh
@lyseihakh 4 года назад
how about app killed/terminated?
@RdozeTV
@RdozeTV 3 года назад
with mauron, yes it still working if app is terminated (not in the background) if you set up properly. You need to properly close the bindings and rebind when u open the app again thats the trick
@minalchhetri3878
@minalchhetri3878 2 года назад
@@RdozeTV Using Mauran library it works well in android but in ios it not working well in background?
@ravindumadhushan7098
@ravindumadhushan7098 4 года назад
can you provide the code sir?
@jonasgroendahl
@jonasgroendahl 4 года назад
gist.github.com/jonasgroendahl/c4fad8fa48f955b993d928e1c36d76f7
@devfriday
@devfriday Год назад
It's not work in 2022.
@AlessioMitrotta
@AlessioMitrotta Год назад
Did you manage to build the app with the library used by Jonas in the video? I'm sstruggling, would be useful to know which library version he was using
@devfriday
@devfriday Год назад
@@AlessioMitrotta Yes ! I use this version.
Далее
React Native modern starter kit (template)
8:02
Просмотров 6 тыс.
In app purchases and subscriptions in React Native
20:34
меня не было 9 дней
12:48
Просмотров 2,3 млн
▼ЕГО БОЯЛИСЬ МОНГОЛЫ 🍣
32:51
Просмотров 451 тыс.
Integrate payments in React Native (Stripe)
23:03
Просмотров 20 тыс.
Background Geolocation Introduction
6:31
Просмотров 47 тыс.
How to host static Nextjs site to S3
21:07
Просмотров 9 тыс.
Aula 15 - Background Tasks
23:24
Просмотров 4,8 тыс.