omaraflak / Bluetooth-Library

Bluetooth client library for Android.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Keep connection between activities?

kvnramirez opened this issue · comments

Hi, I've been trying your library and works great, but I was wondering if it's possible to pass the connection between activites avoiding to reconnect everytime I change from activity? And if it's possible, how?

Hi @kvnramirez, I'm not sure because my Arduino has a problem right now so I can't test.
But if you don't call arduino.close() the connection should be maintained. That said, I don't think this is the right way to do it. If you want to keep the connection across multiple activities you should probably use the library in a Service.