java no such method_AndroidJavaProxy no such method exception,AndroidJavaProxy no such proxy method ...

The first thing to do is read the documentation for AndroidJavaProxy to give you a basic concept of what this class does and what it should be used for.

Typically, you would use this class when you need to callback from Java code back to your Unity C# code. It helps by removing some of the "messy" code you have to write to achieve that.

In order to use AndroidJavaProxy, you must have a Java interface that you wish to implement. You then declare a new class derived from AndroidJavaProxy that should define the methods that will be called back from Java.

Optionally, you can define a C# interface that matches the Java interface so you don't forget to implement any of the required methods (this is not a must, in case there's no interface defined, Unity will try to match the methods by name).

Now to your code in question:

class DailyBudgetCallback : AndroidJavaProxy

{

public DailyBudgetCallback()

: base("ir.ordibehesht.sdk.sdk.playservices.interfaces.DailyBudgetCallback")

{

}

public void onDailyBudgetResponse(DailyBudget dailyBudget)

{

Debug.Log("daily budget response ");

}

}

You defined a new class that is derived from AndroidJavaProxy, passing the name of the required Java interface in its constructor. So far so good.

The callback method onDailyBudgetResponse receives a parameter called DailyBudget. You didn't specify what this object is.

If this is an object that is defined in Java, your C# code knows nothing about it (even if you created a matching type in your C# code).

If that is the case, you should declare it as a AndroidJavaObject type. What this means is that effectively your callback is called, passing a reference to a Java type that you can interact with, using the AndroidJavaObject object instance.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值