http://phpfiddle.org/
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'keykeykeykeykeykeykeykeykeykey' );
$registrationIds = array("idididiidididiidididiidididiidididiidididiidididiidididiidididiidididiidididiidididiidididiidididiidididi" );
// prep the bundle
$msg = array
(
'message' => 'here is a message. message',
'title' => 'This is a title. title',
'subtitle' => 'This is a subtitle. subtitle',
'tickerText' => 'Ticker text here...Ticker text here...Ticker text here',
'vibrate' => 1,
'sound' => 1
);
$fields = array
(
'registration_ids' => $registrationIds,
'data' => $msg
);
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
$result = curl_exec($ch );
curl_close( $ch );
echo $result;
?>
'Android' 카테고리의 다른 글
[Android] android GridView Auto-Column Span (0) | 2016.11.08 |
---|---|
[Android] 안드로이드 Toolbar menu 버튼 만들기 (0) | 2016.11.07 |
[Android] 안드로이드 커스텀 네비게이션 드로어 만들기(Custom Navigation Drawer) (0) | 2016.11.03 |
[Android] 안드로이드 디바이스 해상도별 레이아웃 대응 라이브러리(ScalableLayout) (0) | 2016.11.03 |
팝업 메뉴 (0) | 2016.05.24 |