I am trying to send a bluetoothSocket to another activity, but since it isn't Parcelable
nor Serializable
I am kind of at a loss about what to do.
I haven't found anything else on this though I've searched to find an example somewhere.
Managing a BluetoothSocket
in an Activity
sounds like a bad idea as the BluetoothSocket
will be somewhat tied to the Activity
lifecycle. You should consider moving the BluetoothSocket
to a Service
instead. The different activities that need to use the BluetoothSocket
can then do so through the Service
instance. You also get an extra benefit: your BluetoothSocket
can remain active even though your application is not in the foreground.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.