Skip to content

vicktor/vampire

Repository files navigation

vampire_xs

vampire | Delighted to suck your glucoses

Give me back my fucking data

How it works

The application works like a vampire, sucking glucose data from the permanent notifications that apps have to show the patient their data.

It will only work with apps that have this notification and update it regularly with the glucose value.

So, what can it do?

Read glucose from notifications and share it with anyone through internal WebServer, BroadCast to another apps, Health Connect and ContentProvider. Optionally you can write all information in Google Health Connect.

Based on the great xDrip+ project without which, vampire would not exist.

Screenshots

vampire health glucosa

Configuration

App needs special permission to read your notifications, you can inspect the code for your safety and peace of mind.

Go to Settings -> Accessibility -> Notifications and allow vampire to access your notifications, allow all Go to Settings -> Batery -> Select vampire, Battery Saving and select No Restrictions

CGM supported

From xDrip+

    coOptedPackages.add("com.dexcom.g6")
    coOptedPackages.add("com.dexcom.g6.region1.mmol")
    coOptedPackages.add("com.dexcom.g6.region3.mgdl")
    coOptedPackages.add("com.dexcom.dexcomone")
    coOptedPackages.add("com.dexcom.g7")
    coOptedPackages.add("com.camdiab.fx_alert.mmoll")
    coOptedPackages.add("com.camdiab.fx_alert.mgdl")
    coOptedPackages.add("com.camdiab.fx_alert.hx.mmoll")
    coOptedPackages.add("com.camdiab.fx_alert.hx.mgdl")
    coOptedPackages.add("com.medtronic.diabetes.guardian")
    coOptedPackages.add("com.medtronic.diabetes.minimedmobile.eu")
    coOptedPackages.add("com.medtronic.diabetes.minimedmobile.us")

Reading via Intent BroadCast

Declare something similar in your AndroidManifest

<receiver android:name=".receivers.VampireReceiver"
    android:enabled="true"
    android:exported="true">
    <intent-filter>
        <action android:name="xyz.bauber.vampire.SEND_GLUCOSE" />
    </intent-filter>
</receiver>

Create your BroadCast Receiver

class VampireReceiver : BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent) {
        val bundle = intent.extras
        val units = bundle?.getString("units")
        val glucose = bundle?.getFloat("glucose")
        val time = bundle?.getLong("timestamp")
        val trend = bundle?.getString("trend")
        val source = bundle?.getString("source")
    }
}

Remember to write destination PackageName

Reading data Health Connect

Currently under development but works, only a few things need to be finished about permissions

Take a look at Health Connect API

Health Connect SDK

Health Connect Toolbox

Reading data with ContentProvider

Removed

Reading data with WebServer

Surely, this is the easiest way to access the data, all the data read is stored in a table and made available to any app through a web server with only 2 endpoints to retrieve the information.

Open http://localhost:5566/glucoses from your app to read last 24 hours of glucoses

Open http://localhost:5566/glucose from your app to read last glucose value

All data are returned in JSON:

{ 
  "glucoseType":"interstitial",
  "glucoseUnits":"mgdl",
  "glucoseValue":140.0,
  "origin":"Dexcom",
  "timestamp":1685461844641,
  "timestampOffset":120,
  "trend":"FLAT"
}

ToDo

Code needs to be improved and unused parts removed

It would be very interesting if someone can test with FreeStyleLibre, right now I don't have any sensor to test, the package name would be com.freestylelibre3.app, I add it to VampireCollector code

Bugs

Sometimes the service stops and does not continue to collect data. If anyone knows how to fix this, open an issue or make a pull request.

Example of integration

SocialDiabetes App working with Vampire in real-time via Intent BroadCast

SocialDiabetes

Contributing

Of course, contributions are what make the open source community such an amazing place to learn, inspire, and create.

If you have a suggestion that would make Vampire better, please fork the repo and create a pull request.

Any contributions you make are greatly appreciated.

Credits

Icon -> icon-icons.com

WebServer -> NanoHTTPD

Thanks

Again kudos to awesome xDrip+ Team and all people fighting against diabetes.

And don't forget to star ☆, fork and contribute!