http - How to receive remote push notifications in android using GCM in Delphi 10 -
i trying send , receive remote push notifications using gcm services, when had delphi xe7 method in answer 2 in question working [google cloud messaging in delphi xe5?, in seattle dosent, java errors, however, i've followed answer in question, , managed device token id, cant dont receive notification when send mobile phone, code 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); params.free; end; freeandnil(idhttp); end;
added <service android:name="com.embarcadero.gcm.notifications.gcmintentservice" />
in androidmanifest.template.xml , checked receive remote push notifications in entitlement list.
Comments
Post a Comment