/// <summary> /// Creates a {@link AndroidDebugBridge} that is not linked to any particular executable. /// This bridge will expect adb to be running. It will not be able to start/stop/restart</summary> /// adb. /// If a bridge has already been started, it is directly returned with no changes /// <returns></returns> public static AndroidDebugBridge CreateBridge() { if (instance != null) { return(instance); } try { instance = new AndroidDebugBridge(); instance.Start(); instance.OnBridgeChanged(new AndroidDebugBridgeEventArgs(instance)); } catch (ArgumentException) { instance.OnBridgeChanged(new AndroidDebugBridgeEventArgs(null)); instance = null; } return(instance); }
/// <summary> /// Creates a new debug bridge from the location of the command line tool. /// </summary> /// <param name="osLocation">the location of the command line tool 'adb'</param> /// <param name="forceNewBridge">force creation of a new bridge even if one with the same location /// already exists.</param> /// <returns>a connected bridge.</returns> /// <remarks>Any existing server will be disconnected, unless the location is the same and /// <code>forceNewBridge</code> is set to false. /// </remarks> public static AndroidDebugBridge CreateBridge( String osLocation, bool forceNewBridge ) { if ( _instance != null ) { if ( !String.IsNullOrEmpty ( AdbOsLocation ) && string.Compare ( AdbOsLocation, osLocation, true ) == 0 && !forceNewBridge ) { return _instance; } else { // stop the current server Log.d (TAG, "Stopping Current Instance" ); _instance.Stop ( ); } } try { _instance = new AndroidDebugBridge ( osLocation ); _instance.Start ( ); _instance.OnBridgeChanged ( new AndroidDebugBridgeEventArgs ( _instance ) ); } catch ( ArgumentException ) { _instance.OnBridgeChanged ( new AndroidDebugBridgeEventArgs ( null ) ); _instance = null; } return _instance; }
/// <summary> /// Creates a {@link AndroidDebugBridge} that is not linked to any particular executable. /// This bridge will expect adb to be running. It will not be able to start/stop/restart</summary> /// adb. /// If a bridge has already been started, it is directly returned with no changes /// <returns></returns> public static AndroidDebugBridge CreateBridge( ) { if ( _instance != null ) { return _instance; } try { _instance = new AndroidDebugBridge ( ); _instance.Start ( ); _instance.OnBridgeChanged ( new AndroidDebugBridgeEventArgs ( _instance ) ); } catch ( ArgumentException ) { _instance.OnBridgeChanged ( new AndroidDebugBridgeEventArgs ( null ) ); _instance = null; } return _instance; }