I registered Google Cloud Messaging(GCM) system. I am using Delphi Xe8 .
I need to get android device token for send notification with gcm.
But I have no idea about device token.
How can I get device token ?
I registered Google Cloud Messaging(GCM) system. I am using Delphi Xe8 .
I need to get android device token for send notification with gcm.
But I have no idea about device token.
How can I get device token ?
p : TJavaObjectArray<JString>;
begin
gcm := TJGoogleCloudMessaging.JavaClass.getInstance(SharedActivity.getApplicationContext);
p := TJavaObjectArray<JString>.Create(1);
p.Items[0] := StringToJString('GCM Project Id');
Memo1.Lines.Add(JStringToString(gcm.register(p)));
end;
If you are following this manual http://docwiki.embarcadero.com/RADStudio/XE8/en/Multi-Device_Application_to_Receive_Push_Notifications
Then at the point on this manual where you make events from PushEvents1 You can get Devicetoken by this code.
procedure TForm1.PushEvents1DeviceTokenReceived(Sender: TObject);
begin
ShowMessage('Devicetoken received');
ShowMessage(PushEvents1.BindSource.Adapter.PushSender.DeviceToken);
end;
You can get the DeviceID and DeviceToken using follow code...