appinfo.sendPushMsg - GiGAGenie-ServiceSDK/UserGuide GitHub Wiki
gigagenie.appinfo.sendPushMsg
API 설명
- Push 보내기 API
- 해당 GiGA Genie 에 등록된 GiGA Genie Companion App 에 Push 메시지를 보냄
- Push 메시지는 모바일 단말에 푸시 팝업이 보여지며 해당 팝업 클릭시 해당 msg(URL)로 모바일 단말의 웹브라우저를 실행
※ 주의 ※
기가지니 단말과 기가지니 앱이 페어링 되어 있어야 가능하다. 페어링이 되어 있지 않을 경우 페어링 요청하는 팝업을 띄워야 한다. 페어링 유무는 appinfo.getUserInfo
의 extra.registwithapp
으로 확인할 수 있다.
API 구조
- function sendPushMsg(options,callback)
options
target
: (String, Mandatory) 다음의 값만 가질 수 있음COMP_APP
: 해당 G-Box 에 연계된 Companion App 을 타겟으로 한다.
msgtype
: (String, Mandatory) 다섯 가지 값 중 선택하여 사용EXEC_WEB
: Web Browser 의 URL 에 해당 msg 를 전달 및 실행한다.EXEC_CALL
: 모바일 통화연결 요청 Push 를 전송한다.EXEC_TONE
: 화자식별/ 등록 요청한다.EXEC_AGREE
: 기가지니 홈 화면으로 이동하는 Push를 보낸다.EXEC_BANK
: 기가지니앱 뱅크 화면으로 이동하는 Push를 보낸다.
msg
: (String, Mandatory) 로 보내고자 하는 메시지이며 EXEC_WEB 의 경우 web url 을, EXEC_CALL 의 경우 통화에 설정할 전화번호를 설정해야 함popuptext
: (String, Optional) 팝업 문구이며 (android만 적용됨) null일 경우 Default 메시지가 전달됨saveYN
: (String, Optional) GApp 푸시 알림함 저장 여부이며 Default 값은 Y
result_cd
는 다음과 같이 정의된다.200
: 성공500
: 시스템 Error
extra
- null
사용 예시
// callback 방식
var options = {};
options.target = 'COMP_APP';
options.msgtype = 'EXEC_WEB';
options.msg = 'http://hello.world/hello?msg=world';
gigagenie.appinfo.sendPushMsg(options, function (result_cd, result_msg, extra) {
if (result_cd === 200) {
console.log("Sending Push msg to companion app is Success");
} else {
console.log("Sending Push msg to companion app Set is fail.");
}
});
// promise 방식
var options = {};
options.target = 'COMP_APP';
options.msgtype = 'EXEC_WEB';
options.msg = 'http://hello.world/hello?msg=world';
gigagenie.appinfo.sendPushMsg(options).then(function (extra) {
console.log("Sending Push msg to companion app is Success");
}).catch(function (result_cd, result_msg, extra) {
console.log("Sending Push msg to companion app Set is fail.");
})