i am trying to send and receive remote push notifications using GCM services, when i had Delphi xe7 this method in the answer 2 in this question was working [Google Cloud Messaging in Delphi XE5?, but in Seattle it dosent, i get java errors, however, i've followed the answer in this question, and managed to get the device Token id, but i cant dont receive the notification when i send it to my mobile phone, this is the code to send :
const
sendUrl = 'https://android.googleapis.com/gcm/send';
var
Params: TStringList;
AuthHeader: STring;
idHTTP: TIDHTTP;
SSLIOHandler: TIdSSLIOHandlerSocketOpenSSL;
begin
idHTTP := TIDHTTP.Create(nil);
try
SslIOHandler := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
idHTTP.IOHandler := SSLIOHandler;
idHTTP.HTTPOptions := [];
Params := TStringList.Create;
try
Params.Add('registration_id='+ Memo1.Lines.Text);
Params.Values['data.message'] := Edit1.Text;
idHTTP.Request.Host := sendUrl;
AuthHeader := 'Authorization: key=' + MyServerKey;
idHTTP.Request.CustomHeaders.Add(AuthHeader);
IdHTTP.Request.ContentType := 'application/x-www-form-urlencoded;charset=UTF-8';
idHTTP.Post(sendUrl, Params);
finally
Params.Free;
end;
finally
FreeAndNil(idHTTP);
end;
Added <service android:name="com.embarcadero.gcm.notifications.GCMIntentService" />
in my AndroidManifest.template.xml and checked receive remote push notifications in Entitlement List.