- Joined
- Jul 3, 2017
- Messages
- 261
So, I've got a skeleton of a module, implementing Admob rewarded video ads (on top of the old interstitial module). It shows the test ad, and it receives the message with "10 coins" (the standard reward AFAIK)
My question is: is there any way I can make a callback from Java to Monkey? Something like this:
'AdmobRewards.monkey
Class AdmobRewards Extends Null = "AdmobRewards"
Method ShowAd:Void(myFunction)
End Class
'AdmobRewards.java
class AdmobRewards implements Runnable{
public void ShowAd( myFunction) { _callback = myFunction; }
static public void registerReward(RewardItem reward) { _callback(reward); }
}
So far I'm just storing those values on variables and passing them to Monkey with 'getRewardType' and 'getRewardAmmount' - but this is a hack job, would be nice to be able to just have a 'rewardReceived' abstract method or something available in Monkey to be used.
My question is: is there any way I can make a callback from Java to Monkey? Something like this:
'AdmobRewards.monkey
Class AdmobRewards Extends Null = "AdmobRewards"
Method ShowAd:Void(myFunction)
End Class
'AdmobRewards.java
class AdmobRewards implements Runnable{
public void ShowAd( myFunction) { _callback = myFunction; }
static public void registerReward(RewardItem reward) { _callback(reward); }
}
So far I'm just storing those values on variables and passing them to Monkey with 'getRewardType' and 'getRewardAmmount' - but this is a hack job, would be nice to be able to just have a 'rewardReceived' abstract method or something available in Monkey to be used.