How to patch the Librelink app to provide xDrip with Value received by bluetooth directly from sensor
IF YOU WANT TO USE THIS, YOU NEED TO ACTIVATE A NEW SENSOR AFTER THE INSTALLATION PROCEDURE IS COMPLETED, IT DOES NOT WORK WITH ALLREADY ACTIVATED SENSORS!!
Already activated sensors will also stop sending alarms to the handset device if they had been activated with the unpatched phone app.
-
Load the Version 2.3.0 of the freestyle Libre App DE, for example from here or here (The German version does have english language, don't worry.)
-
[OPTIONAL] If you want to check if your Version is correct, check the MD5 (for windows you might need to get an App like: http://www.winmd5.com to perform md5 checksumming). The Checksum should be:
420735605bacf0e18d2570079ebaa238
-
Load the apkTool and install it as described here. It seems that the current 2.4 Version of Apktool has some problems on Windows, please download and install an older 2.3 Version if you are using Windows!
-
Open a CMD-Prompt (windows) or Shell (*nix) where you downloaded the apk (e.g. your download folder)
-
Use the apktool:
apktool d -o librelink [FILENAME_OF_THE_DOWNLOADED_APK]
-
You should now have a folder named
librelink
with all the extracted files of the application -
Copy the patch Files from this repository to the same location as the
librelink
folder (you should now have a directory with at least the following files/folders:librelink
,xdrip2.git.patch
,sources
andxdrip2.patch
)
Use either of the two methods:
- For Windows, get the patch tool from here and install it correctly. Mac, Linux and *nix should have patch onboard, if not install from your trusted repository.
- Change in the prompt/shell into the
librelink
folder - Use the Patch tool with the patch:
patch -p1 --binary --merge < ../xdrip2.patch
. for Windowspatch -p1 --binary --merge < ..\xdrip2.patch
. Be sure to use CMD-Prompt and not PowerShell,a s PowerShell does not support < operation.
- Get your git client ready. For windows install something like this
- Change in the prompt/shell into the
librelink
folder - Use igt to apply the patch:
git apply ../xdrip2.git.patch
, for Windowsgit apply ..\xdrip2.git.patch
- In your Filebrowser navigate within the librelink folder to the path
smali_classes2/com/librelink/app/
- Copy the following Files from the
sources
folder of this repository to this folder:ThirdPartyIntegration.smali
ForegroundService.smali
CrashReportUtil.smali
APKExtractor.smali
- Rename the Downloaded APK to
original.apk
- Copy the
original.apk
into the Folderassets
in thelibrelink
folder
- In the Prompt/Shell move into the folder, which contains the
librelink
folder - Use apktool to rebuild the APK:
apktool b -o librelink.apk librelink
- Generate a Signing keystore:
keytool -genkey -v -keystore librelink.keystore -alias librelink -keyalg RSA -keysize 2048 -validity 10000
- Fill in the necessary informations. You must enter two passwords, one for the keystore, one for the key, you should note them down! I prefer to use rather simple passwords like both times
librelink
as this keystore is only for the resigned app - If this fails, please install current java developer tools like this
- If you need to update the App later, omit this step, as the keystore is now available.
- Fill in the necessary informations. You must enter two passwords, one for the keystore, one for the key, you should note them down! I prefer to use rather simple passwords like both times
- Sign the APK:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore librelink.keystore librelink.apk librelink
. If the jarsigner is not found in Windows, please check that your java variables are setup correctly, like described here
- Uninstall the current librelink app on the phone.
- Copy the generated
librelink.apk
to your phone (USB, google drive, ... gmail will not work) and install it.
Open the app, go to "Alarms" and give all necessary permissions that the app requests, or else the first sensor you will start with the app will not transmit any data via Bluetooth!!! As an alternative, you can navigate to the app in your android-settings -> security and enbale there all permission (Location and Files)
If all Steps where succesfully executed, you will have now a patched librelink app, capable of sending its data to xDrip.
Wait for more informations about which Version/Patches you need for xDrip to get the Data to Display!