Guest Posted April 16, 2019 (edited) Hi, I am trying to use Admob Rewarded Video on Delphi and found this solution https://enhance.co/documentation/native-android/rewarded-ads They have java connector and I converted this Jar library with Java2OP.exe to pascal. (files attached post) I can use basic java classes but I dont know how to use java procedures, I need help this level. can any one help me how can run this java example code on delphi. Thank you. This code working and showing rewarded video successful. if TJEnhance.JavaClass.isRewardedAdReady=true then begin TJEnhance.JavaClass.showRewardedAd(TJEnhance_RewardCallback.Wrap(TJEnhance.GetClsID)); end; This is what I need to pascal if(Enhance.isRewardedAdReady()) { // The ad is ready, show it Enhance.showRewardedAd(new RewardCallback() { // Callbacks: @Override public void onRewardGranted(int rewardValue, RewardType rewardType) { if(rewardType == RewardType.ITEM) writeLog("Reward granted (item)"); else if(rewardType == RewardType.COINS) writeLog("Reward granted (coins), value: " + rewardValue); } @Override public void onRewardDeclined() { writeLog("Reward declined"); } @Override public void onRewardUnavailable() { writeLog("Reward unavailable"); } }); } Enhance-Connector.pas about TJEnhance_RewardCallback JEnhance_RewardCallbackClass = interface(IJavaClass) ['{CC51ED09-CBAB-43A9-A7C7-73675C3B6F55}'] end; [JavaSignature('co/enhance/Enhance$RewardCallback')] JEnhance_RewardCallback = interface(IJavaInstance) ['{46C10767-D981-4109-9D96-6B9C43900405}'] procedure onRewardDeclined; cdecl; procedure onRewardGranted(P1: Integer; P2: JEnhance_RewardType); cdecl; procedure onRewardUnavailable; cdecl; end; TJEnhance_RewardCallback = class(TJavaGenericImport<JEnhance_RewardCallbackClass, JEnhance_RewardCallback>) end; JEnhance_RewardTypeClass = interface(JEnumClass) ['{BE09443C-986F-4419-9C51-30E565A4648D}'] {class} function _GetCOINS: JEnhance_RewardType; cdecl; {class} function _GetITEM: JEnhance_RewardType; cdecl; {class} function valueOf(P1: JString): JEnhance_RewardType; cdecl; {class} function values: TJavaObjectArray<JEnhance_RewardType>; cdecl; {class} property COINS: JEnhance_RewardType read _GetCOINS; {class} property ITEM: JEnhance_RewardType read _GetITEM; end; [JavaSignature('co/enhance/Enhance$RewardType')] JEnhance_RewardType = interface(JEnum) ['{CA724C25-BB1E-41D7-B106-CBA3E07077E1}'] end; TJEnhance_RewardType = class(TJavaGenericImport<JEnhance_RewardTypeClass, JEnhance_RewardType>) end; Enhance-Connector.jar Enhance-Connector.pas Edited April 16, 2019 by Guest Share this post Link to post
Dave Nottage 557 Posted April 16, 2019 6 hours ago, pieomy said: This is what I need to pascal You cannot do that part in Delphi; it needs to be done in Java, then you can consume it from your Delphi code. Share this post Link to post