앱과 서버. , 서버리스 ex) 파이어베이스(구글)
Request, Response
API (Application Programming Interface): 서버쪽에서 정한 규칙
- 주소를 통해 만들어진 api .
- 제공해주는 함수를 통해 규칙제공. >> firebase
useEffect();
팁 찜하기.
openweathermap api.
import * as Location from "expo-location";
const getLocation = async () => { try {
//자바스크립트 함수의 실행순서를 고정하기 위해 쓰는 async,await
await Location.requestForegroundPermissionsAsync();
const locationData= await Location.getCurrentPositionAsync();
console.log(locationData['coords']['latitude'])
console.log(locationData['coords']['longitude'])
} catch (error) {
Alert.alert("위치를 찾을 수가 없습니다.", "앱을 껏다 켜볼까요?");
}
}
|
1. 앱 위치 정보 권한 설정. expo install expo-location await Location.requestForegroundPermissionsAsync(); const locationData= await Location.getCurrentPositionAsync(); console.log(locationData['coords']['latitude']) console.log(locationData['coords']['longitude']) 2. 함수 실행 순서를 정해주는 async / await async , await |
4-2 15:34
'App' 카테고리의 다른 글
[스파르타코딩클럽] 웹개발자가 듣는 앱개발 초보 강의_리엑트네이티브 기본 (0) | 2022.12.13 |
---|---|
[스파르타코딩클럽] 웹개발자가 듣는 앱개발 초보 강의_JSX & style (0) | 2022.11.20 |