quamotion / madb

SharpAdbClient is a .NET library that allows .NET applications to communicate with Android devices. It provides a .NET implementation of the adb protocol, giving more flexibility to the developer than launching an adb.exe process and parsing the console output.
Apache License 2.0
360 stars 133 forks source link

ADBClient changes (singelton is gone) #225

Open rickx opened 2 years ago

rickx commented 2 years ago

Hi, can anybody explain why the sort of singleton in ADBClient (you accessed it using ADBClient.Instance) was removed? I see now the ADBClient needs to be sent as parameter everywhere. Is there any advantage in this? What happens if you instantiate multiple ADBClients - doesn't that cause any issues? Or is there a special mode to do so without risk?

thx

xutongqing commented 1 year ago

Hey everyone.

The AdbClient has a simple constructor. All that is missing from the current docs is to remove the static singleton Instance accessor usage and instead create one single instance and use that AdbClient yourself.

As with any OSS project I'm thinking either we all figure it out on our own, or we raise a PR to suggest a change.

So until anyone of us does that I suggest you just new up an instance of the AdbClient and go from there! It's suggested to only use one such instance for your app.

just see this from respone