제로에서 독립으로개발전체 학습 경로
등록APICloud사용자 이름,다운로드 및 설치APICloud Studio 3개발도구,설정개발매트릭스
APICloud Studio 3새 프로젝트, 에 대해 알아보기프로젝트 구조 및 문서 정리
사용 방법 배우기APICloud센터API,실현데이터서로、온프레미스저장소 등기능
활용HTML、CSS및JavaScript모바일 구축애플리케이션인터페이스,반응형 디자인 구현하기
활용APICloud클라우드 컴퓨팅서비스,생성Android및iOS애플리케이션
계정을 등록하고설정개발매트릭스
doAPICloud센터API사용 방법
함께 사용서비스공정 장비HTTP요청,실현데이터서로
api.ajax({
url: 'https://api.example.com/data',
method: 'get',
data: {
values: {
page: 1,
limit: 10
}
}
}, function(ret, err) {
if (ret) {
console.log(JSON.stringify(ret));
} else {
console.log(JSON.stringify(err));
}
});
매개변수 설명:
에 사용온프레미스비축데이터,문서 포함작업、데이터저장소 등
// 비축데이터
var fs = api.require('fs');
fs.writeFile({
path: 'fs://userInfo.json',
data: JSON.stringify({name: '신원 미상', age: 20})
}, function(ret, err) {
if (ret.status) {
console.log('스토리지 성공');
} else {
console.log('스토어 실패');
}
});
// 검색데이터
fs.readFile({
path: 'fs://userInfo.json'
}, function(ret, err) {
if (ret.status) {
console.log(JSON.parse(ret.data));
} else {
console.log('검색에 실패했습니다.');
}
});
일반적인 방법:
페이지 간 이동을 위해,를 클릭하고 매개변수
// 새 페이지 열기
api.openWin({
name: 'detail',
url: 'detail.html',
pageParam: {
id: 1,
title: '제품 세부 정보'
}
});
// 수신 매개변수
var pageParam = api.pageParam;
console.log(pageParam.id); // 수출:1
console.log(pageParam.title); // 수출:제품 세부 정보
매개변수 설명:
디바이스 정보를 가져오는 데 사용、작업가전 제품기능등
// 디바이스 정보 가져오기
api.getDeviceInfo(function(ret, err) {
if (ret) {
console.log('장비 모델:' + ret.model);
console.log('시스템릴리스:' + ret.systemVersion);
console.log('가전 제품ID:' + ret.deviceId);
}
});
// 카메라 호출하기
api.getPicture({
sourceType: 'camera',
encodingType: 'jpg',
mediaValue: 'pic',
destinationType: 'url',
allowEdit: true,
quality: 50,
saveToPhotoAlbum: false
}, function(ret, err) {
if (ret) {
console.log('이미지 경로:' + ret.data);
}
});
인기API:
활용APICloud클라우드 컴퓨팅서비스움직임 생성애플리케이션
A: 컴파일 로그 보기,오류 메시지에 따른 수정 사항。일반적인 원인은 다음과 같습니다.:코드 오류、인증서설정이슈、권한설정버그.
A: iOS컴파일에는 다음이 필요합니다.Apple개발사용자 계정 및 해당 인증서(Development또는Distribution인증서).
A: Android애플리케이션이 작업은 다음을 통해 직접 수행할 수 있습니다.APK파일 설치;iOS애플리케이션통과 필요TestFlight또는기업배포 방법 설치.
A: 일반적으로 다음이 필요합니다.3-10분,정확한 시기는 다음에 따라 다릅니다.애플리케이션크기 및 현재 컴파일 대기열 상태.
처음부터 간단한 모바일 구축애플리케이션
활용APICloud간단한 일기 예보 작성애플리케이션,다음을 달성하세요.기능:
// 날씨 보기데이터
function getWeather(city) {
api.ajax({
url: 'https://api.example.com/weather',
method: 'get',
data: {
values: {
city: city,
key: 'your_api_key'
}
}
}, function(ret, err) {
if (ret) {
console.log(JSON.stringify(ret));
// 업데이트UI날씨 표시데이터
updateWeatherUI(ret);
} else {
console.log(JSON.stringify(err));
api.alert({msg: '날씨 보기데이터실패(예: 실험)'});
}
});
}
// 현재 위치 가져오기
function getCurrentLocation() {
api.getLocation({
type: 'gps',
timeout: 10000,
accuracy: 'high'
}, function(ret, err) {
if (ret) {
console.log(JSON.stringify(ret));
// 위도와 경도를 기준으로 도시 이름 가져오기
getCityByLocation(ret.lat, ret.lon);
} else {
console.log(JSON.stringify(err));
api.alert({msg: '위치 확인에 실패했습니다.'});
}
});
}
// 업데이트된 날씨UI
function updateWeatherUI(data) {
// 도시 이름 업데이트
document.getElementById('cityName').innerHTML = data.city;
// 온도 업데이트
document.getElementById('temperature').innerHTML = data.temp + '°C';
// 업데이트된 기상 조건
document.getElementById('weatherDesc').innerHTML = data.desc;
// 날씨 아이콘 업데이트
document.getElementById('weatherIcon').src = data.icon;
// 업데이트된 미래 일기 예보
updateForecast(data.forecast);
}