Загрузка страницы

Get live address of user in react-native app | Expo-cli | Current Address | Live Location React |

Follow the below commands to start

1 . expo init livelocation

2 . cd livelocation

3 . expo install expo-location

4 . import * as Location from "expo-location";

5 . async function GetCurrentLocation () {
let { status } = await Location.requestPermissionsAsync();

if (status !== "granted") {
Alert.alert(
"Permission not granted",
"Allow the app to use location service.",
[{ text: "OK" }],
{ cancelable: false }
);
}

let { coords } = await Location.getCurrentPositionAsync();

if (coords) {
const { latitude, longitude } = coords;
let response = await Location.reverseGeocodeAsync({
latitude,
longitude,
});

for (let item of response) {
let address = `${item.name}, ${item.street}, ${item.postalCode}, ${item.city}`;

setUserLocation(address);
}
}
};

#reactnative #expo #location #reactnativeapp #programmer

Видео Get live address of user in react-native app | Expo-cli | Current Address | Live Location React | канала Jeet Vani
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
28 ноября 2021 г. 11:40:35
00:06:05
Яндекс.Метрика