Device Info 가이드 프로그램은 모바일 디바이스 API 실행환경을 활용하여 하이브리드 앱을 개발 시 참고 및 활용될 수 있도록 구현 된 전자정부 디바이스 API에 대한 가이드 앱으로써,
모바일 스마트 디바이스의 메타 정보를 JavaScript 기반으로 구성 된 DeviceInfoAPI 를 통하여 조회 할 수 있도록 지원한다.
또한, 전자정부 표준프레임워크 기반의 웹 서버 어플리케이션과 연계하여 디바이스 내 메타 정보를 조회하여 서버에 전송하고 조회할수 있는 기능으로 구성되어 있다.
본 가이드 프로그램 에서는 디바이스의 메타 정보 조회 기능의 활용을 가이드 할 수 있도록 디바이스 정보 조회하기, 디바이스 정보 서버에 전송하기,
디바이스 정보 목록을 서버로부터 수신하기 를 제공하고 있다.
| 구분 | 내용 |
|---|---|
| Local 디바이스 개발 환경 | Xcode 8.0 (8A218a), Cordova 6.4.0 |
| 서버 사이드 개발 환경 | 전자정부표준프레임워크 개발환경3.6 |
| Mash up Open API 연계 | N/A |
| 테스트 디바이스 | iPhone 6 , iPad Air |
| 테스트 플랫폼 | iOS 9.3, iOS 10.0 |
| 추가 라이브러리 적용 | 스토리지 정보 조회를 위한 추가 플러그인 적용 |
폰갭에서 특정 외부 도메인이나 외부 도메인의 하위 도메인을 사용해야할 경우,
[Project_name]/Supporting Files/comfig.xml에서 <access origin=“ExternalHosts”/> 항목에 외부 도메인 주소를 추가 설정해야 외부 도메인에 접속할 수 있다.
DeviceInfo 디바이스API 가이드 프로그램은 크게 디바이스 정보 조회하기, 디바이스 정보 서버에 전송하기, 디바이스 정보 목록을 서버로부터 수신하기
기능으로 구성되어 있다.(관련기능 부분참조)
| 유형 | 대상소스명 | 비고 |
|---|---|---|
| CSS | assets/www/css/egovframwork/mbl/hyb/DeviceInfoAPI.css | DeviceInfoAPI 가이드 프로그램 주요 Cascading Style Sheets |
| IMAGE | assets/www/images/egovframwork/mbl/hyb/ | DeviceInfoAPI 가이드 프로그램 주요 Image 폴더 |
| JS | assets/www/js/egovframwork/mbl/hyb/DeviceInfoAPI.js | DeviceInfoAPI가이드 프로그램 주요 JavaScript |
| HTML | assets/www/DeviceInfoAPI.html | DeviceInfoAPI 메인 페이지 |
| HTML | assets/www/license.html | DeviceInfoAPI 라이센스 페이지 |
| HTML | assets/www/overview.html | DeviceInfoAPI 기능설명 페이지 |
| HTML | assets/www/intro.html | DeviceInfoAPI Intro 페이지 |
| RES | [Project_Name]/Resources/ | DeviceInfoAPI가이드 프로그램 주요 Resource 폴더 |
| PLIST | [Project_Name]/Resources/[Project_Name]-Info.plist | iOS 어플리케이션 설정 파일 |
var name = device.name; var cordova= device.cordova; var platform = device.platform; var uuid = device.uuid; var version = device.version;
| 변수 | 설명 | 비고 |
|---|---|---|
| name | 디바이스에 셋팅된 명칭을 반환한다. | |
| cordova | 어플리케이션에서 사용된 폰갭 버전을 반환한다. | |
| platform | 모바일 디바이스의 플랫폼 정보를 반환한다. | |
| uuid | 디바이스 고유의 UUID를 반환한다. | |
| version | 디바이스의 플랫폼 버전을 반환한다. |
window.addEventListener("batterycritical", yourCallbackFunction, false);
window.addEventListener("batterylow", yourCallbackFunction, false);
window.addEventListener("batterystatus", yourCallbackFunction, false);
StorageInfo.totalFileSystemSize(successCallback, failCallback, []);
StorageInfo.freeFileSystemSize(successCallback, failCallback, []);
| 유형 | 대상소스명 | 비고 |
|---|---|---|
| Controller | egovframework.hyb.ios.dvc.web.EgovDeviceiOSAPIController.java | DeviceInfoAPI 가이드 프로그램 Controller Class |
| Service | egovframework.hyb.ios.dvc.service.EgovDeviceiOSAPIService.java | DeviceInfoAPI 가이드 프로그램 Service Class |
| ServiceImpl | egovframework.hyb.ios.dvc.service.impl.EgovDeviceiOSAPIServiceImpl.java | DeviceInfoAPI 가이드 프로그램 ServiceImpl Class |
| VO | egovframework.hyb.ios.dvc.service.DeviceiOSAPIVO.java | DeviceInfoAPI 가이드 프로그램 VO Class |
| DAO | egovframework.hyb.ios.dvc.service.impl.DeviceiOSAPIDAO.java | DeviceInfoAPI 가이드 프로그램 Dao Class |
| QUERY XML | resources/egovframework/sqlmap/hyb/ios/dvc/EgovDeviceiOSAPIGuide_SQL_[DB명].xml | DeviceInfoAPI 가이드 프로그램 QUERY XML |
| 테이블명 | 테이블명(영문) | 비고 |
|---|---|---|
| 디바이스 | Device | 디바이스 정보 관리 |
| No | 컬럼ID | 컬럼명 | 타입 | 길이 | NULL |
|---|---|---|---|---|---|
| 1 | SN | 일련번호 | NUMERIC | 6 | NotNull |
| 2 | UUID | UUID | VARCHAR | 50 | NotNull |
| 3 | TELNO | 전화번호 | VARCHAR | 20 | Null |
| 4 | STRGE_INFO | 스토리지정보 | VARCHAR | 40 | Null |
| 5 | LANG | 언어 | VARCHAR | 15 | Null |
| 6 | NTWRK_DEVICE_INFO | 네트워크디바이스정보 | VARCHAR | 20 | Null |
| 7 | PG_VER | 폰갭버전 | VARCHAR | 40 | Null |
| 8 | DEVICE_NM | 디바이스명 | VARCHAR | 200 | Null |
| 9 | USEYN | 활성화여부 | CHAR | 1 | Null |
DeviceInfo 디바이스API 가이드 프로그램에서 제공하는 모바일 디바이스의 메타 정보 조회 기능을 활용하기 위하여 필요한 항목 및 그 환경 설정은 다음과 같다.
<feature name="Battery"> <param name="ios-package" value="CDVBattery"/> </feature> <feature name="InterfaceAPI"> <param name="ios-package" value="EgovInterface"/> </feature>
<access origin="ExternalHosts"/>
#define kSERVER_URL @"Server_URL"
<sqlMap resource="egovframework/sqlmap/hyb/ios/dvc/EgovDeviceiOSAPIGuide_SQL_[DB명].xml"/>
DeviceInfo 디바이스API 가이드 프로그램은 크게 디바이스 내 메타 정보 조회 기능과 조회된 메타 정보를 서버에 전송하고 조회할수 있는 기능으로 구성되어 있다.
/** 디바이스 정보 VO */
var deviceInfoVO = { sn : "",
uuid : "",
os : "",
telno : "",
strgeInfo : "",
ntwrkDeviceInfo : "",
pgVer : "",
deviceNm : "",
useyn : "" }
function fn_egov_load_deviceInfo() {
deviceInfoVO.ntwrkDeviceInfo = fn_egov_get_networkInfo();
$('.deviceInfo:eq(0)').html(device.platform + " " + device.version);
$('.deviceInfo:eq(1)').html(device.uuid);
$('.deviceInfo:eq(2)').html(device.cordova);
fn_egov_get_contacts();
$('.deviceInfo:eq(4)').html(deviceInfoVO.ntwrkDeviceInfo);
StorageInfo.totalFileSystemSize(fn_egov_totalSpace_success, fn_egov_fail, []);
}
function fn_egov_get_networkInfo() {
var networkState = navigator.network.connection.type;
var states = {};
states[Connection.UNKNOWN] = 'Unknown connection';
states[Connection.ETHERNET] = 'Ethernet connection';
states[Connection.WIFI] = 'WiFi connection';
states[Connection.CELL_2G] = 'Cell 2G connection';
states[Connection.CELL_3G] = 'Cell 3G connection';
states[Connection.CELL_4G] = 'Cell 4G connection';
states[Connection.NONE] = 'No network connection';
return states[networkState];
}
function fn_egov_get_contactsRead(contacts)
{
console.log("[DeviceAPIGuide] fn_egov_get_contactsRead : Success ");
$('.deviceInfo:eq(3)').html("총 " + contacts.length + "개의 연락처");
deviceInfoVO.telno = contacts.length;
}
function fn_egov_get_contacts()
{
var obj = new ContactFindOptions();
obj.filter = "";
obj.multiple = true;
navigator.contacts.find(
[ "displayName", "name" ],
fn_egov_get_contactsRead,
fn_egov_get_contactsFail,
obj);
}
| 디바이스 정보조회 화면 |
|---|
![]() |
OS: 플랫폼 정보 및 버전
UUID : 디바이스의 고유 아이디
PhoneGap Version : DeviceInfo 가이드 프로그램에 적용된 폰갭 버전
Contacts : 디바이스에 저장된 연락처 갯수
Connection Type : 디바이스의 네트워크 상태 정보
Total Memory : 디바이스의 총 메모리
function fn_egov_regist_deviceInfo() {
if(!fn_egov_network_check(true)){
return false;
}
var params = {uuid : device.uuid, os : device.platform + " " + device.version,
telno : deviceInfoVO.telno, strgeInfo : deviceInfoVO.strgeInfo,
ntwrkDeviceInfo : deviceInfoVO.ntwrkDeviceInfo , pgVer : device.cordova};
EgovInterface.submitAsynchronous([params, "/dvc/addDeviceInfo.do"],
function(){
navigator.notification.alert("입력 완료.", null, 'Info');
console.log("[DeviceAPIGuide] fn_egov_regist_deviceInfo : Completed ");
},
function(error) {
$("#alert_dialog").click( function() {
jAlert('데이터 입력 중 오류가 발생 했습니다.', '입력 오류', 'c');
});
}
);
}
| Action | URL | Controller method | QueryID |
|---|---|---|---|
| 디바이스 정보 등록 | /dvc/addDeviceInfo.do | insertDeviceInfo | “deviceiOSAPIDAO.insertDeviceInfo” |
| 디바이스 정보업로드 화면 |
|---|
![]() |
정보 업로드: 디바이스 정보를 서버로 업로드 한다.
function fn_egov_move_deviceInfoList() {
if(!fn_egov_network_check(true)){
return false;
}
var params = {uuid : device.uuid };
EgovInterface.submitAsynchronous([params, "/dvc/deviceInfoList.do"],
fn_egov_dispatch_deviceInfoList,
function(error) {
$("#alert_dialog").click( function() {
jAlert('데이터 조회 중 오류가 발생 했습니다.', '조회 오류', 'c');
});
}
);
}
function fn_egov_dispatch_deviceInfoList(data){
var list_html = "";
var totcnt = data.deviceInfoList.length;
for (var i = 0; i < totcnt; i++) {
result = data.deviceInfoList[i];
list_html += "<li><a href='javascript:fn_egov_request_deviceInfoDetail(" + result.sn + ")'><h3>UUID : " + result.uuid + "</h3>";
list_html += "<p><strong>Network Connection Type : " + result.ntwrkDeviceInfo + "</strong></p>";
list_html += "<p>OS : " + result.os + "</p></a></li>";
}
var theList = $('#theList');
theList.html(list_html);
$.mobile.changePage("#deviceInfoList", "slide", false, false);
theList.listview("refresh");
console.log("[DeviceAPIGuide] fn_egov_dispatch_deviceInfoList : Completed ");
}
function fn_egov_request_deviceInfoDetail(data){
if(!fn_egov_network_check(true)){
return false;
}
var params = {sn : data };
EgovInterface.submitAsynchronous([params, "/dvc/deviceInfo.do"],
fn_egov_move_deviceInfoDetail,
function(error) {
$("#alert_dialog").click( function() {
jAlert('데이터 조회 중 오류가 발생 했습니다.', '조회 오류', 'c');
});
}
);
}
function fn_egov_move_deviceInfoDetail(result){
$('.deviceInfo:eq(6)').html(result.deviceInfo.os);
$('.deviceInfo:eq(7)').html(result.deviceInfo.uuid);
$('.deviceInfo:eq(8)').html(result.deviceInfo.pgVer);
$('.deviceInfo:eq(9)').html("총 " + result.deviceInfo.telno + "개의 연락처");
$('.deviceInfo:eq(10)').html(result.deviceInfo.ntwrkDeviceInfo);
$('.deviceInfo:eq(11)').html(result.deviceInfo.strgeInfo + " MiB");
$("#btnDelDeviceInfo").attr("href","javascript:fn_egov_confirm_delete_deviceInfo(" + result.deviceInfo.sn + ");");
$.mobile.changePage("#deviceInfoDetail", "slide", false, false);
console.log("[DeviceAPIGuide] fn_egov_move_deviceInfoDetail : Completed ");
}
function fn_egov_confirm_delete_deviceInfo(sn){
jConfirm('Device 정보를 삭제 하시겠습니까??', '알림', 'c', function(r){
if(r == true){
fn_egov_delete_deviceInfo(sn);
}else{
}
});
}
function fn_egov_delete_deviceInfo(data){
if(!fn_egov_network_check(true)){
return false;
}
console.log("fn_egov_delete_deviceInfo : ");
var params = {sn : data };
EgovInterface.submitAsynchronous([params, "/dvc/deleteDeviceInfo.do"],
function(result){
navigator.notification.alert("삭제 완료.", null, 'Info');
console.log("[DeviceAPIGuide] fn_egov_delete_deviceInfo : Completed ");
fn_egov_move_deviceInfoList();
},
function(error) {
$("#alert_dialog").click( function() {
jAlert('데이터 조회 중 오류가 발생 했습니다.', '조회 오류', 'c');
});
}
);
}
| Action | URL | Controller method | QueryID |
|---|---|---|---|
| 디바이스 정보 목록 조회 | /dvc/deviceInfoList.do | selectDeviceList | “deviceiOSAPIDAO.selectDeviceInfoList” |
| 디바이스 정보 상세 조회 | /dvc/deviceInfo.do | selectDeviceInfo | “deviceiOSAPIDAO.selectDeviceInfo” |
| 디바이스 정보 삭제 | /dvc/deleteDeviceInfo.do | deleteDeviceInfo | “deviceiOSAPIDAO.deleteDeviceInfo” |
| 디바이스 목록조회 | 디바이스 상세조회 화면 |
|---|---|
![]() | ![]() |
디바이스 정보 조회 : 디바이스 정보 조회를 요청한다.
목록 : 디바이스 정보 목록 페이지를 호출한다.
삭제 : 디바이스 정보를 삭제한다.
디바이스 어플리케이션에서 발생한 오류 내용 확인 및 디버깅을 위해서는 폰갭 프레임워크에서 제공하는 console.log를 이용할 수 있다. console.log 함수는 자바스크립트 구문에서 사용할 수 있는 디버그 코드로 이클립스 및 Xcode에서 확인 할 수 있다.
function fn_egov_network_check(doCheck)
{
console.log('DeviceAPIGuide fn_egov_network_check');
var networkState = navigator.network.connection.type;
...
}

DeviceInfo 디바이스 API 가이드 프로그램 에서는 디버깅을 위하여 다음과 같이 콘솔 정보를 출력한다.
| 디버그 코드 | 디버깅 내용 |
|---|---|
| [DeviceAPIGuide] fn_egov_onBatteryStatus : Success | 디바이스의 배터리 정보 변경 시 |
| [DeviceAPIGuide] fn_egov_onBatteryLow : Success | 디바이스의 배터리 레벨이 로우 상태 진입 시 |
| [DeviceAPIGuide] fn_egov_onBatteryCritical : Success | 디바이스의 배터리 레벨이 크리티컬 상태 진입 시 |
| [DeviceAPIGuide] fn_egov_get_contactsRead : Success | 디바이스 연락처 갯수 조회 성공 시 |
| [DeviceAPIGuide] fn_egov_get_contactsFail : Fail | 디바이스 연락처 갯수 조회 실패 시 |
| [DeviceAPIGuide] fn_egov_totalSpace_success : Success | 디바이스의 총 메모리 조회 성공 시 |
| [DeviceAPIGuide] fn_egov_freeSpace_success : Success | 디바이스의 가용 메모리 조회 성공 시 |
| [DeviceAPIGuide] fn_egov_fail : Success | 공통 Fail 콜백 함수 호출 시 |
| [DeviceAPIGuide] fn_egov_regist_deviceInfo : Completed | 디바이스 정보 저장의 성공 수행 시 |
| [DeviceAPIGuide] fn_egov_dispatch_deviceInfoList : Completed | 디바이스 정보 목록 조회의 성공 수행 시 |
| [DeviceAPIGuide] fn_egov_move_deviceInfoDetail : Completed | 디바이스 정보 상세 조회의 성공 수행 시 |
| [DeviceAPIGuide] fn_egov_delete_deviceInfo : Completed | 디바이스의 정보 삭제의 성공 수행 시 |
DeviceInfo Server Applicaton 다운로드 : Click