Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reconnect to previous device #108

Open
darkmoon3d opened this issue Apr 10, 2024 · 2 comments
Open

reconnect to previous device #108

darkmoon3d opened this issue Apr 10, 2024 · 2 comments

Comments

@darkmoon3d
Copy link

How would I setup within code so that app will reconnect to previous device when either app is opened again or connection is lost?

@rockerer
Copy link

Can you provide more information, when you want what to happen?

You can use the IntentFilter to start the app when a device is connected. When you use the IntentFilter the app already has the permission to connect to the device.

You can write code in the init-part of your app to query the list of ports and connect to the (first) device. This connecting process will ask for permission, which has to be granted by the user.

Another idea is to start a scan every x seconds, when no device is connect or when the connection is lost and try to connect, if a device is found.

@darkmoon3d
Copy link
Author

Was thinking more of collecting "serial" of usb device and holding persistent value so when app is restarted (or if usb is detached/reattached or power cycled) the code would recognize and automatically reattach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants