Skip to content

Commit 5b2e23d

Browse files
committed
THETA m15で接続エラーが発生する問題を修正。
1 parent 4323519 commit 5b2e23d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

  • dConnectDevicePlugin/dConnectDeviceTheta/app/src/main/java/org/deviceconnect/android/deviceplugin/theta/core

dConnectDevicePlugin/dConnectDeviceTheta/app/src/main/java/org/deviceconnect/android/deviceplugin/theta/core/ThetaDeviceManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.net.wifi.WifiNetworkSpecifier;
1111
import android.os.Build;
1212
import android.os.Handler;
13+
import android.os.HandlerThread;
1314
import android.os.Looper;
1415
import android.support.annotation.NonNull;
1516

@@ -70,13 +71,16 @@ public class ThetaDeviceManager implements ThetaDeviceDetection.DetectionListene
7071
*/
7172
private final List<ThetaDeviceDetection> mDeviceDetections = new ArrayList<>();
7273

74+
private final HandlerThread mHandlerThread = new HandlerThread(getClass().getName());
75+
7376
/**
7477
* Constructor.
7578
*
7679
* @param context An instance of {@link Context}
7780
*/
7881
public ThetaDeviceManager(final Context context) {
7982
mContext = context;
83+
mHandlerThread.start();
8084
}
8185

8286
/**
@@ -171,6 +175,7 @@ public void stopDeviceDetection() {
171175
*/
172176
public void dispose() {
173177
stopDeviceDetection();
178+
mHandlerThread.quit();
174179
}
175180

176181
/**
@@ -272,7 +277,7 @@ public void onUnavailable() {
272277
startDeviceDetection();
273278
}
274279
};
275-
connectivityManager.requestNetwork(request, callback, new Handler(Looper.getMainLooper()));
280+
connectivityManager.requestNetwork(request, callback, new Handler(mHandlerThread.getLooper()));
276281
return true;
277282
}
278283

0 commit comments

Comments
 (0)