Real-time communication with frontend
- Frontend shows heatmap of most visit places - Maximum accuracy can now be set - Fix bug where battery chart filtered values wrongly
This commit is contained in:
@@ -40,16 +40,12 @@ class TrackerService : Service() {
|
||||
// This thread only connects to RabbitMQ
|
||||
val connectionThread = Thread(Runnable {
|
||||
val client = OkHttpClient()
|
||||
val req = Request.Builder()
|
||||
.url(MainActivity.API_URL)
|
||||
.get()
|
||||
.build()
|
||||
|
||||
val factory = ConnectionFactory()
|
||||
factory.username = "lineage"
|
||||
factory.password = "ZSo\$X97GQ547JXL7nGq"
|
||||
factory.username = MainActivity.USER!!.name
|
||||
factory.password = MainActivity.USER!!.brokerToken
|
||||
factory.virtualHost = "/"
|
||||
factory.host = "nk-home.ddns.net"
|
||||
factory.host = "192.168.178.26"
|
||||
factory.port = 5672
|
||||
factory.isAutomaticRecoveryEnabled = true
|
||||
try {
|
||||
@@ -59,11 +55,10 @@ class TrackerService : Service() {
|
||||
val intent = Intent("de.nicolasklier.livebeat")
|
||||
val bundle = Bundle()
|
||||
bundle.putBoolean("statusRabbit", true)
|
||||
bundle.putInt("statusHttp", client.newCall(req).execute().code)
|
||||
intent.putExtras(bundle)
|
||||
this.sendBroadcast(intent)
|
||||
|
||||
channel[0]?.queueDeclare("tracker", true, false, false, null)
|
||||
channel[0]?.queueDeclare("tracker-" + factory.username, true, false, false, null)
|
||||
//channel[0]?.basicPublish("", "Tracker", null, "Test message".toByteArray())
|
||||
Log.i("RabbitMQ", "run: Published test message")
|
||||
} catch (e: IOException) {
|
||||
@@ -83,7 +78,7 @@ class TrackerService : Service() {
|
||||
val androidId = Settings.Secure.getString(contentResolver, Settings.Secure.ANDROID_ID)
|
||||
|
||||
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
|
||||
locationManager.requestLocationUpdates("gps", 5000, 0f
|
||||
locationManager.requestLocationUpdates("gps", 10000, 0f
|
||||
) { location ->
|
||||
Log.i("Location", "Location is: " + location.latitude + " | " + location.longitude)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user