- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我想开发一个软件,在后台使用处理程序线程扫描可用的 wifi 网络。问题是当我使用 handler.postDelayed()
时,WifiManager.getScanResults()
在正常情况下同时返回 0。
这些是运行时权限:
@Override
protected void onResume() {
super.onResume();
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
{
if(checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
{
requestPermissions(new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 87);
}
}
}
还有我的处理程序:
handler.postDelayed(new Runnable() {
@Override
public void run() {
counter++;
scanWifi();
scannWifiInterval();
if(counter==5){
sum/=5;
textView2.setText(Integer.toString(sum));
}
}
},timeoutSecondGenerator());
和 scanWifi 方法:
private void scanWifi() {
wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
if (!wifiManager.isWifiEnabled()) {
Toast.makeText(this, "WiFi is disabled ... We need to enable it", Toast.LENGTH_LONG).show();
wifiManager.setWifiEnabled(true);
}
arrayList.clear();
registerReceiver(wifiReceiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
wifiManager.startScan();
Toast.makeText(this, "Scanning WiFi ...", Toast.LENGTH_SHORT).show();
}
和BroadCastReciever
:
BroadcastReceiver wifiReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) {
results = wifiManager.getScanResults();
unregisterReceiver(this);
for(int i=0;i<results.size();i++){
}
for (ScanResult scanResult : results) {
if (scanResult.SSID.equals(networkSSID)) {
sum+=scanResult.level;
textView.setText(Integer.toString(scanResult.level));
}
}
}
}
};
日志:
09-16 16:36:47.384 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.454 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.454 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.454 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.454 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.454 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.454 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.474 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.474 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:36:47.474 2536-2536/? E/ViewRootImpl: mStopped=false mHasWindowFocus=false mPausedForTransition=false
09-16 16:37:02.169 1478-1849/? E/WifiStateMachine: result: -1266999764, Moved BSSID: 80:2a:a8:9a:ea:da
09-16 16:37:02.269 2681-2692/? E/Auth: [GoogleAccountDataServiceImpl] getToken() -> NETWORK_ERROR. Account: <ELLIDED:905778253>, App: com.google.android.googlequicksearchbox, Service: oauth2:https://www.googleapis.com/auth/googlenow
pez: Error when calling server.
at gnx.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):279)
at gnx.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):24)
at gnx.b(:com.google.android.gms@13280016@13.2.80 (040304-211705629))
at gmi.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):34)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):13)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):148)
at iet.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):16)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):33)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):69)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):254)
at wwt.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at cgv.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):5)
at android.os.Binder.transact(Binder.java:387)
at djf.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: javax.net.ssl.SSLHandshakeException: Connection closed by peer
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@13280016@13.2.80 (040304-211705629):15)
at com.google.android.gms.common.net.SSLCertificateSocketFactory.verifyHostname(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at com.google.android.gms.common.net.SSLCertificateSocketFactory.createSocket(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:188)
at com.android.okhttp.Connection.connect(Connection.java:1324)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:1412)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:131)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:481)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:462)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:368)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:476)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:118)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:249)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java)
at yod.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):32)
at imu.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):1)
at gnj.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at gnj.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at gnx.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):109)
at gnx.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):24)
at gnx.b(:com.google.android.gms@13280016@13.2.80 (040304-211705629))
at gmi.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):34)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):13)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):148)
at iet.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):16)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):33)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):69)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):254)
at wwt.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at cgv.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):5)
at android.os.Binder.transact(Binder.java:387)
at djf.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at android.os.Binder.execTransact(Binder.java:453)
09-16 16:37:02.419 17764-17764/? E/Zygote: no v2
09-16 16:37:02.489 2681-17697/? E/Auth: [GoogleAccountDataServiceImpl] getToken() -> NETWORK_ERROR. Account: <ELLIDED:905778253>, App: com.google.android.googlequicksearchbox, Service: oauth2:https://www.googleapis.com/auth/googlenow
pez: Error when calling server.
at gnx.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):279)
at gnx.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):24)
at gnx.b(:com.google.android.gms@13280016@13.2.80 (040304-211705629))
at gmi.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):34)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):13)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):148)
at iet.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):16)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):33)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):69)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):254)
at wwt.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at cgv.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):5)
at android.os.Binder.transact(Binder.java:387)
at djf.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: javax.net.ssl.SSLHandshakeException: Connection closed by peer
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@13280016@13.2.80 (040304-211705629):15)
at com.google.android.gms.common.net.SSLCertificateSocketFactory.verifyHostname(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at com.google.android.gms.common.net.SSLCertificateSocketFactory.createSocket(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:188)
at com.android.okhttp.Connection.connect(Connection.java:1324)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:1412)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:131)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:481)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:462)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:368)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:476)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:118)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:249)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java)
at yod.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):32)
at imu.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):1)
at gnj.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at gnj.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at gnx.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):109)
at gnx.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):24)
at gnx.b(:com.google.android.gms@13280016@13.2.80 (040304-211705629))
at gmi.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):34)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):13)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):148)
at iet.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):16)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):33)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):69)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):254)
at wwt.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at cgv.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):5)
at android.os.Binder.transact(Binder.java:387)
at djf.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at android.os.Binder.execTransact(Binder.java:453)
09-16 16:37:02.499 2400-17412/? E/VelvetNetworkClient: Failed to get auth token
09-16 16:37:02.589 2400-17412/? E/UpdateGcmReg: Network error while trying to register for GCM updates
09-16 16:37:03.320 2681-4954/? E/Auth: [GoogleAccountDataServiceImpl] getToken() -> NETWORK_ERROR. Account: <ELLIDED:905778253>, App: com.google.android.instantapps.supervisor, Service: oauth2:https://www.googleapis.com/auth/playatoms
pez: Error when calling server.
at gnx.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):279)
at gnx.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):24)
at gnx.b(:com.google.android.gms@13280016@13.2.80 (040304-211705629))
at gmi.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):34)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):13)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):148)
at iet.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):16)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):33)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):69)
at gjc.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):4)
at gjb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at gjb.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at gja.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):1)
at gkz.getAuthToken(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:214)
at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:113)
at android.os.Binder.transact(Binder.java:387)
at djf.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at android.os.Binder.execTransact(Binder.java:453)
Caused by: javax.net.ssl.SSLHandshakeException: Connection closed by peer
at com.google.android.gms.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.google.android.gms.org.conscrypt.NativeSsl.doHandshake(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at com.google.android.gms.org.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@13280016@13.2.80 (040304-211705629):15)
at com.google.android.gms.common.net.SSLCertificateSocketFactory.verifyHostname(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at com.google.android.gms.common.net.SSLCertificateSocketFactory.createSocket(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at com.android.okhttp.internal.http.SocketConnector.connectTls(SocketConnector.java:188)
at com.android.okhttp.Connection.connect(Connection.java:1324)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:1412)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:131)
at com.android.okhttp.internal.http.HttpEngine.nextConnection(HttpEngine.java:481)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:462)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:368)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:476)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:118)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:249)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java)
at yod.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):32)
at imu.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):1)
at gnj.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at gnj.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at gnx.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):109)
at gnx.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):24)
at gnx.b(:com.google.android.gms@13280016@13.2.80 (040304-211705629))
at gmi.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):34)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):13)
at ift.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):148)
at iet.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):16)
at ieq.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):33)
at dhb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):69)
at gjc.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):4)
at gjb.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):2)
at gjb.c(:com.google.android.gms@13280016@13.2.80 (040304-211705629):6)
at gja.a(:com.google.android.gms@13280016@13.2.80 (040304-211705629):1)
at gkz.getAuthToken(:com.google.android.gms@13280016@13.2.80 (040304-211705629):8)
at android.accounts.AbstractAccountAuthenticator$Transport.getAuthToken(AbstractAccountAuthenticator.java:214)
at android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticator.java:113)
at android.os.Binder.transact(Binder.java:387)
at djf.onTransact(:com.google.android.gms@13280016@13.2.80 (040304-211705629):3)
at android.os.Binder.execTransact(Binder.java:453)
09-16 16:37:03.350 17542-17787/? E/Isotope: UID: [10104] PID: [17542] HygieneTask : GetArchiveDownload RPC failed
eer: UNAUTHENTICATED
at bai.b(PG:6)
at baf.call(PG:9)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at bke.run(PG)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.io.IOException: NetworkError
at android.accounts.AccountManager.convertErrorToException(AccountManager.java:2138)
at android.accounts.AccountManager.-wrap0(AccountManager.java)
at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1996)
at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
at android.os.Binder.execTransact(Binder.java:453)
09-16 16:37:03.350 17542-17789/? E/Isotope: UID: [10104] PID: [17542] HygieneTaskService : Archive Prefetching failed
eer: UNAUTHENTICATED
at bai.b(PG:6)
at baf.call(PG:9)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at bke.run(PG)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.io.IOException: NetworkError
at android.accounts.AccountManager.convertErrorToException(AccountManager.java:2138)
at android.accounts.AccountManager.-wrap0(AccountManager.java)
at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1996)
at android.accounts.IAccountManagerResponse$Stub.onTransact(IAccountManagerResponse.java:69)
at android.os.Binder.execTransact(Binder.java:453)
09-16 16:37:03.370 2681-14277/? E/NetworkScheduler: Invalid component specified.
09-16 16:37:03.390 2681-14277/? E/NetworkScheduler: Invalid component specified.
09-16 16:37:03.420 1478-1632/? E/NativeLibraryHelper: Failed to load assets verifier: 0
09-16 16:37:03.700 1478-1632/? E/NativeLibraryHelper: Failed to load assets verifier: 0
继续扫描但什么也没发现
minSdkVersion 17targetSdkVersion 28
我在 samsung galaxy s9 上运行它
如果有人回答,我将不胜感激。
最佳答案
终于找到问题所在了。我刚刚将 targetSdkVersion 从 28 更改为 22,它成功了!我认为在某些 Android 设备上运行时权限不是答案,您还需要在 list 文件中设置它,而在 sdk 28 程序中只设置运行时权限。
关于java - wifiManager.getScanResults() 返回 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52353577/
我正在搜索可用的 wifi 网络扫描,但 getScanResults() 方法返回空列表。 我包含了所需的所有权限: android.permission.ACCESS_COARSE_LOCATIO
作为 Android 编程的新手,我尝试使用 WifiManager 的 getScanResults() 方法获取 SSID 列表,但它仍然是空的,即使我已授予它 ACCESS_COARSE_LOC
我按照下面的代码将扫描结果存储到列表中: List results = wifi.getScanResults(); sb = new StringBuilder();
list的大小为0,是Android6.0中WifiManager.getScanResults()的返回值我已经给了他权限(ACCESS_FINE_LOCATION 和 ACCESS_COARSE_
我正在尝试使用 getScanResults() 显示 WiFi 的扫描结果。但是,当引用 getScanResults 的信息时会发生崩溃。更详细一点,当添加两行代码时crash就发生了: if(r
我想扫描周围的 WiFi 网络并显示它们,但是当我使用 WifiManager.getScanResult() 时,我得到一个空列表。 我已经在 list 中请求了许可,并且我尝试使用运行时,但调试器
我想开发一个软件,在后台使用处理程序线程扫描可用的 wifi 网络。问题是当我使用 handler.postDelayed() 时,WifiManager.getScanResults() 在正常情况
我正在尝试检测 wifi 连接中的信号强度变化。我对应该在 BroadcastReceiver 中使用哪种方法感到困惑。使用 getConnectionInfo() 和 getScanResults(
在我的 Droid 2 上,wifi.getScanResults() 似乎会在短时间内返回旧值。 这意味着当我在家时,wifi.getScanResults() 将显示我的家庭网络。如果我沿着几英里
我正在开发一个 Android 项目来扫描我们办公室的本地 WiFi 环境。简而言之,我们想要找到不属于那里的接入点。 问题:Android 似乎没有返回有关具有隐藏 SSID 的接入点的信息。有谁知
我正在尝试创建一个代码来返回可用的 Wi-Fi 网络。但我面临一个问题。 getScanResults 返回空值,尽管我已提供所有可能的网络权限。 public class MainActivity
是的,我确实查看了所有其他类似问题,但它们对我不起作用。我正在尝试获取我附近可用的 wifi 连接列表。我就是这样做的: public class WifiFunction { privat
我想澄清一下 WifiManager.getScanResults() 的行为,即: 启用无线时 android 是否按固定时间间隔扫描接入点?可以查询/更改间隔吗?可以查询上次扫描的时间吗?有关讨论
当设备进入打瞌睡模式时,我遇到了 wifiManager.getScanResults() 在 Oreo (API26) 上返回空列表的问题。在进入打瞌睡之前,以及在早期的 API 版本上,一切正常(
permissionsList.add() 不起作用,但 MainActivity.this.requestPermissions() 可以正常工作。问题是它带来了一个对话框,询问用户是否允许位置权限
我正在开发一个应用程序来检查 Wifi 热点。 我在 wifiManager.getScanResults() 收到错误“java.lang.SecurityException:需要 ACCESS_C
我试图在这个 gif 中解释问题 基本上,此测试应用会收到“RSSI_CHANGED” Intent 并在屏幕上显示扫描结果。 除非启用 GPS,否则扫描结果始终为空。 我想我的问题是为什么? To
我已经在 android 6.0 版本 - Marshmallow 中申请了权限,但是在使用 getScanResults() 时它仍然返回空列表。 private boolean checkPer
考虑来自 https://developer.android.com/guide/topics/connectivity/wifi-scan#java 的原始示例: public class Main
我是一名优秀的程序员,十分优秀!