What the purpose of doing (MyJobject as ILocalObject).GetObjectID


In delphi Tokyo source code i see this 2 differents way to retrieve a “service Manager”

var FLocationManager: JLocationManager;
FLocationManager := TJLocationManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.LOCATION_SERVICE));

and :

var FNotificationManager: JNotificationManager;
var NotificationServiceNative: JObject;
NotificationServiceNative := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.NOTIFICATION_SERVICE);
FNotificationManager := TJNotificationManager.Wrap((NotificationServiceNative as ILocalObject).GetObjectID);

What is exactly the difference between these 2 ways ? why in the second case they do (NotificationServiceNative as ILocalObject).GetObjectID and not in the first case ?

Comments are closed.