안녕하세요.
푸쉬를 보내려고 하는데.. 잘 몰라서 질문합니다.
웹뷰를 이용한 앱이구요
public static String SENDER_ID = "발급받은 아이디..";
// 디바이스 체크
GCMRegistrar.checkDevice(context);
// AndroidManifest.xml 체크
GCMRegistrar.checkManifest(context);
GCMRegistrar.unregister(context);
// Registration ID 발급 요청
GCMRegistrar.register(context, SENDER_ID);
String regId = GCMRegistrar.getRegistrationId(this);
를 해서
System.out.println("Registration ID1 : "+regId);
regId 하면 값을 받아오구요 --> 이걸 php url 로 보내서 디비에 저장하구요
$insert = "insert into mobile_member(member_id ,device_uid,reg_date ) values('".$myPhoneNumber."', '".$device_uid."', now() )";
mysql_query($insert);
----------------------------------- push 발송 ------------------------
###### 안드로이드 S ######
$headers = array("Content-Type:application/json", "Authorization:key=발급받은 키 넣었습니다.");
// API Key
$REGID = $deviceuid;
$MSG = $push_message;
$arr = array();
$arr['data'] = array();
$arr['data']['msg'] = $MSG;
$arr['registration_ids'] = array();
$arr['registration_ids'][0] = $REGID;
// 푸쉬가 도착했을 때 앱에서 추가적으로 자료를 활용할 수 있음.
$arr['data']['url'] = $push_link;
//echo "<pre>"
//print_r($arr);
//exit;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, '
https://android.googleapis.com/gcm/send');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr));
$response = curl_exec($ch);
$response_decode = json_decode($response, true);
echo "<pre>";
print_r($response_decode);
// break;
echo $response_decode['success'];
if($response_decode['success']) {
echo "성공";
} else {
echo "실패";
}
curl_close($ch);
###### 안드로이드 E ######
이렇게 php 부분을 짜놨는데요
페이지상에서는 success =>1 failure =>0 이라고 성공이라고는 나오는데요 실제로는 단말기로 푸쉬가 안옵니다.
어느 부분을 더 찾아봐야 하는건가요??ㅜㅠ
도움 부탁드립니다.