Skip to content

Commit f083331

Browse files
committed
Now crashes if a new device cannot be found
1 parent eb6596e commit f083331

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: wear-socket/src/main/java/com/github/jrejaud/wear_socket/WearSocket.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.os.AsyncTask;
66
import android.os.Bundle;
77
import android.util.Log;
8+
import android.widget.Toast;
89

910
import com.google.android.gms.common.ConnectionResult;
1011
import com.google.android.gms.common.api.GoogleApiClient;
@@ -102,7 +103,9 @@ public void run() {
102103
String nodeID = findBestNodeId(nodes);
103104
Log.d(TAG,"Node found: "+nodeID);
104105
if (nodeID==null) {
105-
showErrorAndCloseApp("Error, cannot find a connected device",true);
106+
String message = "Error, cannot find a connected device";
107+
Toast.makeText(context,message,Toast.LENGTH_SHORT).show();
108+
new Throwable(message);
106109
return;
107110
}
108111
WearSocket.this.nodeID = nodeID;
@@ -147,6 +150,7 @@ public void run() {
147150
//*************************************************************************************
148151

149152
private void showErrorAndCloseApp(String message, boolean closeApp) {
153+
Toast.makeText(context,message,Toast.LENGTH_SHORT).show();
150154
Log.e(TAG, message);
151155
disconnect();
152156
if (closeApp) {

0 commit comments

Comments
 (0)