我想将onRecieve()函数与QT快速应用程序连接起来。
public void onReceive(Context context, Intent intent){
//some code
}
我的cpp
QAndroidJniObject intent("android/content/Intent");
QAndroidJniObject::callStaticObjectMethod("org/qtproject/example/WifiReceiver","onReceive","(Landroid/content/Context;Landroid/content/Intent;)V;",QtAndroid::androidContext().object(),intent.object());
当我尝试执行此操作时,出现此错误
W System.err:java.lang.NoSuchMethodError:没有静态方法 “ Lorg / qtproject / example / WifiReceiver; .onReceive(Landroid / content / Context; Landroid / content / Intent;)V;”
清单文件:
<receiver android:name="org.qtproject.example.WifiReceiver" >
<intent-filter android:priority="100">
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
</receiver>
如何解决此错误?