我想通过jni调用C中的java,但我有一个问题:
我的代码如下:
m = (*env)->GetMethodID(env, clazz, "getScanResults", "()[B");
LOG_INFO("startScan Failed %d, %d", __LINE__,m);
jobjectArray rArray = (*env)->CallObjectMethod(env, wifiMgrObj, m);
...
但是'm'总是返回0。 我认为“()[B”可能错了,但我不知道如何FIXIT,任何人都可以帮助我吗?
这是关于'getScanResults'的android API https://developer.android.com/reference/android/net/wifi/WifiManager.html#getScanResults()
getScanResults
Added in API level 1
List<ScanResult> getScanResults ()
Return the results of the latest access point scan.
Returns List<ScanResult> the list of access points found in the most recent scan. An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get valid results. If there is a remote exception (e.g., either a communication problem with the system service or an exception within the framework) an empty list will be returned.
答案 0 :(得分:1)
List<ScanResult>
。GetMethodID()
的JNI签名表示它返回byte[]
。它没有。javap -s
的结果。这绝不是错的。