mirror of
https://github.com/hackku21/nearby_connections.git
synced 2024-10-27 19:14:01 +00:00
added java logs
This commit is contained in:
parent
e6935b59d2
commit
29e12cd581
@ -32,6 +32,7 @@ import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
|
|||||||
import io.flutter.plugin.common.MethodChannel.Result;
|
import io.flutter.plugin.common.MethodChannel.Result;
|
||||||
import io.flutter.plugin.common.PluginRegistry.Registrar;
|
import io.flutter.plugin.common.PluginRegistry.Registrar;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
/**
|
/**
|
||||||
* NearbyConnectionsPlugin
|
* NearbyConnectionsPlugin
|
||||||
*/
|
*/
|
||||||
@ -93,6 +94,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
.addOnSuccessListener(new OnSuccessListener<Void>() {
|
.addOnSuccessListener(new OnSuccessListener<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void aVoid) {
|
public void onSuccess(Void aVoid) {
|
||||||
|
Log.d("NearbyCon java","started advertising");
|
||||||
result.success(true);
|
result.success(true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -109,7 +111,6 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
int strategy = (int) call.argument("strategy");
|
int strategy = (int) call.argument("strategy");
|
||||||
|
|
||||||
assert userNickName != null;
|
assert userNickName != null;
|
||||||
Nearby.getConnectionsClient(activity).stopAllEndpoints();
|
|
||||||
Nearby.getConnectionsClient(activity).startDiscovery(
|
Nearby.getConnectionsClient(activity).startDiscovery(
|
||||||
userNickName,
|
userNickName,
|
||||||
endpointDiscoveryCallback,
|
endpointDiscoveryCallback,
|
||||||
@ -117,6 +118,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
.addOnSuccessListener(new OnSuccessListener<Void>() {
|
.addOnSuccessListener(new OnSuccessListener<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Void aVoid) {
|
public void onSuccess(Void aVoid) {
|
||||||
|
Log.d("NearbyCon java","started discovery");
|
||||||
result.success(true);
|
result.success(true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -129,10 +131,12 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "stopAllEndpoints":
|
case "stopAllEndpoints":
|
||||||
|
Log.d("NearbyCon java","stopAllEndpoints");
|
||||||
Nearby.getConnectionsClient(activity).stopAllEndpoints();
|
Nearby.getConnectionsClient(activity).stopAllEndpoints();
|
||||||
result.success(null);
|
result.success(null);
|
||||||
break;
|
break;
|
||||||
case "disconnectFromEndpoint": {
|
case "disconnectFromEndpoint": {
|
||||||
|
Log.d("NearbyCon java","disconnectFromEndpoint");
|
||||||
String endpointId = call.argument("endpointId");
|
String endpointId = call.argument("endpointId");
|
||||||
assert endpointId != null;
|
assert endpointId != null;
|
||||||
Nearby.getConnectionsClient(activity).disconnectFromEndpoint(endpointId);
|
Nearby.getConnectionsClient(activity).disconnectFromEndpoint(endpointId);
|
||||||
@ -140,6 +144,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "requestConnection": {
|
case "requestConnection": {
|
||||||
|
Log.d("NearbyCon java","requestConnection");
|
||||||
String userNickName = (String) call.argument("userNickName");
|
String userNickName = (String) call.argument("userNickName");
|
||||||
String endpointId = (String) call.argument("endpointId");
|
String endpointId = (String) call.argument("endpointId");
|
||||||
|
|
||||||
@ -213,6 +218,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
private final ConnectionLifecycleCallback advertConnectionLifecycleCallback = new ConnectionLifecycleCallback() {
|
private final ConnectionLifecycleCallback advertConnectionLifecycleCallback = new ConnectionLifecycleCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionInitiated(@NonNull String endpointId, @NonNull ConnectionInfo connectionInfo) {
|
public void onConnectionInitiated(@NonNull String endpointId, @NonNull ConnectionInfo connectionInfo) {
|
||||||
|
Log.d("NearbyCon java","ad.onConnectionInitiated");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
args.put("endpointName", connectionInfo.getEndpointName());
|
args.put("endpointName", connectionInfo.getEndpointName());
|
||||||
@ -223,6 +229,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionResult(@NonNull String endpointId, @NonNull ConnectionResolution connectionResolution) {
|
public void onConnectionResult(@NonNull String endpointId, @NonNull ConnectionResolution connectionResolution) {
|
||||||
|
Log.d("NearbyCon java","ad.onConnectionResult");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
int statusCode = -1;
|
int statusCode = -1;
|
||||||
@ -248,6 +255,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnected(@NonNull String endpointId) {
|
public void onDisconnected(@NonNull String endpointId) {
|
||||||
|
Log.d("NearbyCon java","ad.onDisconnected");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
channel.invokeMethod("ad.onDisconnected", args);
|
channel.invokeMethod("ad.onDisconnected", args);
|
||||||
@ -257,6 +265,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
private final ConnectionLifecycleCallback discoverConnectionLifecycleCallback = new ConnectionLifecycleCallback() {
|
private final ConnectionLifecycleCallback discoverConnectionLifecycleCallback = new ConnectionLifecycleCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionInitiated(@NonNull String endpointId, @NonNull ConnectionInfo connectionInfo) {
|
public void onConnectionInitiated(@NonNull String endpointId, @NonNull ConnectionInfo connectionInfo) {
|
||||||
|
Log.d("NearbyCon java","dis.onConnectionInitiated");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
args.put("endpointName", connectionInfo.getEndpointName());
|
args.put("endpointName", connectionInfo.getEndpointName());
|
||||||
@ -267,6 +276,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionResult(@NonNull String endpointId, @NonNull ConnectionResolution connectionResolution) {
|
public void onConnectionResult(@NonNull String endpointId, @NonNull ConnectionResolution connectionResolution) {
|
||||||
|
Log.d("NearbyCon java","dis.onConnectionResult");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
int statusCode = -1;
|
int statusCode = -1;
|
||||||
@ -292,6 +302,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisconnected(@NonNull String endpointId) {
|
public void onDisconnected(@NonNull String endpointId) {
|
||||||
|
Log.d("NearbyCon java","dis.onDisconnected");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
channel.invokeMethod("dis.onDisconnected", args);
|
channel.invokeMethod("dis.onDisconnected", args);
|
||||||
@ -313,6 +324,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
private final EndpointDiscoveryCallback endpointDiscoveryCallback = new EndpointDiscoveryCallback() {
|
private final EndpointDiscoveryCallback endpointDiscoveryCallback = new EndpointDiscoveryCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onEndpointFound(@NonNull String endpointId, @NonNull DiscoveredEndpointInfo discoveredEndpointInfo) {
|
public void onEndpointFound(@NonNull String endpointId, @NonNull DiscoveredEndpointInfo discoveredEndpointInfo) {
|
||||||
|
Log.d("NearbyCon java","onEndpointFound");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
args.put("endpointName", discoveredEndpointInfo.getEndpointName());
|
args.put("endpointName", discoveredEndpointInfo.getEndpointName());
|
||||||
@ -322,6 +334,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEndpointLost(@NonNull String endpointId) {
|
public void onEndpointLost(@NonNull String endpointId) {
|
||||||
|
Log.d("NearbyCon java","onEndpointLost");
|
||||||
Map<String, Object> args = new HashMap<>();
|
Map<String, Object> args = new HashMap<>();
|
||||||
args.put("endpointId", endpointId);
|
args.put("endpointId", endpointId);
|
||||||
channel.invokeMethod("dis.onEndpointLost", args);
|
channel.invokeMethod("dis.onEndpointLost", args);
|
||||||
|
Loading…
Reference in New Issue
Block a user