티스토리 뷰
728x90
반응형
var request = require('request');
var url = 'https://fcm.googleapis.com/fcm/send';
var apikey = 'AAAA3WrrgCQ:APA91bHQnxgfAP4hurrF3OyBGla-oU3IO3cU9L6BmAvlmm1Ifbm130tTCqttTU2nJiOI4Q5_0-mdz5ht-d_6hLTW9XqvE1TDfIHTYOhsHipFNjwDNnKNRoKl7gnztok2_ZJC45j2k???';
//fcm
var token = 'dJvWJi4Kwss:APA91bGyIma2jGAXvAGV75zlEhY9fo8ev0QFUevFy5tIY6aazHQIImHUdOkuMdzWESGUgjULB2Swy-o4Q07k_37PqZ8-9WXqE1gwko4Z2v3Mw55PjR1qBghd0JCEPFMWnikkAQp7_???';
var options = {
method: 'POST',
url: url,
headers: {
'Content-Type': 'application/json',
'Authorization': `key=${apikey}`
},
body: JSON.stringify({
to: token,
priority: 'high',
notification: {
body: 'Background message',
title: 'BG title'
},
data: {
title: 'FG title',
message: 'Foreground message'
}
})
};
console.log(options);
request(options, function (err, res, body) {
if (!err) {
console.log(body);
console.log(res.statusCode);
} else {
console.log(err);
}
});
반응형
'모바일 프로그래밍' 카테고리의 다른 글
Android Google Drive API 예제 (0) | 2018.10.21 |
---|---|
Android Button의 문자열이 꽉차게 하기 (0) | 2018.08.17 |
Android GCM Node.js 발송 예제 (0) | 2018.05.31 |
Android 8.0 Oreo notification channel (0) | 2018.05.19 |
Android Studio 3.1 Kotlin Support 빌드 에러 (0) | 2018.05.11 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday