Class TMessaging
Unit
Declaration
type TMessaging = class(TObject)
Description
Message system to communicate between native code (Pascal) and other languages (Java on Android, Objective-C on iOS) that possibly run in other thread. Use through auto-created Messaging singleton. On platforms other than Android / iOS, it simply does nothing — messsages are not send anywhere.
To make this work, on Android you need to declare your Android project type as "integrated" (this is actually the default now). See https://castle-engine.io/android-Services . For iOS it is always enabled.
All the communication is asynchronous on all platforms – Pascal code sends a message, and any answers will come asynchronously later. This means that e.g. TGameService.RequestSignedIn will never call TGameService.OnStatusChanged right inside, the call to TGameService.OnStatusChanged will always happen at a later time.
This is used automatically by various engine classes like TGameService, TAds, TAnalytics, TInAppPurchases.
Hierarchy
- TObject
- TMessaging
Overview
Methods
constructor Create; |
|
destructor Destroy; override; |
|
procedure Send(const Strings: array of string); |
|
class function BoolToStr(const Value: boolean): string; |
|
class function TimeToStr(const Value: TFloatTime): string; |
|
class function MessageToBoolean(const Value: String): Boolean; |
Properties
property OnReceive: TMessageReceivedEventList read FOnReceive; |
|
property Log: boolean read FLog write FLog default false; |
Description
Methods
constructor Create; |
|
destructor Destroy; override; |
|
procedure Send(const Strings: array of string); |
|
Send a message to a service (implemented in other language, like Java on Android or Objective-C on iOS). |
class function BoolToStr(const Value: boolean): string; |
|
Convert boolean to 'true' or 'false' string, which will be understood correctly by the service receiving the messages. |
class function TimeToStr(const Value: TFloatTime): string; |
|
Convert float time (in seconds) to integer miliseconds, which are understood correctly by the service receiving the messages. |
Properties
property OnReceive: TMessageReceivedEventList read FOnReceive; |
|
Callbacks called when new message from service is received. |
Generated by PasDoc 0.16.0.