,但我有一個問題:JNI:如何使用的GetMethodID因爲我要調用java用C雖然JNI getScanResults
我的代碼如下:
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,任何人都可以幫助我嗎?
以下是有關Android的API 'getScanResults' 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.
看到http://www.rgagnon.com/javadetails/java-0286.html – pskink
我知道了,謝謝 – zs2014