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.");
})