[+] Connect bluetooth inside serice
This commit is contained in:
@@ -20,6 +20,7 @@ import org.hydev.wearsync.bles.decoders.HeartRateDecoder
|
|||||||
import org.hydev.wearsync.bles.decoders.IDecoder
|
import org.hydev.wearsync.bles.decoders.IDecoder
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import java.util.concurrent.atomic.AtomicLong
|
import java.util.concurrent.atomic.AtomicLong
|
||||||
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
|
|
||||||
|
|
||||||
class MyService : Service()
|
class MyService : Service()
|
||||||
@@ -40,9 +41,12 @@ class MyService : Service()
|
|||||||
fun init()
|
fun init()
|
||||||
{
|
{
|
||||||
influx = prefs.createInflux()
|
influx = prefs.createInflux()
|
||||||
startCollect()
|
ble.connectAddress(prefs.chosenDevice ?: return notif(text = "❌ No bluetooth devices chosen")) {
|
||||||
registerReceiver(mBatInfoReceiver, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
|
startCollect()
|
||||||
|
notif(sub = "Bluetooth Connected!")
|
||||||
|
|
||||||
|
registerReceiver(mBatInfoReceiver, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
|
||||||
|
}
|
||||||
notif(sub = "Bluetooth Connecting...")
|
notif(sub = "Bluetooth Connecting...")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user