yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy S 5 Unified Development] shaggyskunk:
It's pretty straightforward to just install the apk before installing S Health... I'd be more interested in figuring out how to get Spo2 to work on my S7 - It works on TW - But I'd rather eat worms than run TW ?

From Down the Rabbit Hole by:

My SM-G930W8 ??
[Samsung Galaxy S 5 Unified Development] tty78:
Perfect !!!

Works on G900F with Lineage OS 14.1 .

Thanks a lot :D:D:D
[Samsung Galaxy S 5 Unified Development] shaggyskunk:
Has anyone been able to get the Spo2 Sensor to work on AOSP Roms? Galaxy S7 SM-G930W8

From Down the Rabbit Hole by:

My SM-G930W8 ??
[Samsung Galaxy S 5 Unified Development] Zauberlehrling!:
Works great now. I even have Stress measure, what the original Rom for S5 didn't give me.

Now I only have the issue that I cannot verify my number through S Health.

Do you have an idea how to solve this, please?
[Samsung Galaxy S 5 Unified Development] shaggyskunk:
Yeah I didn't have to verify anything - Just setup an email account (if you want to be able to restore data after a Clean Flash) I'm not sure if you have to setup an account at all if you don't care about restoring data.

From Down the Rabbit Hole by:

My SM-G930W8 ??
[Samsung Galaxy S 5 Unified Development] wayan_billie:
I have same issue cannot varify my phone number,

---------- Post added at 03:40 AM ---------- Previous post was at 03:35 AM ----------

I was setup the email n my data is complate

But in (together) phone verification always failed,

Sory for bad english
[Samsung Galaxy S 5 Unified Development] shaggyskunk:
can you post a screen shot of the phone number verification failure? Be SURE TO HIDE your phone number before posting the screen shot!!!!

Like I said I didn't have to verify anything - I don't know if it's related to the **Country** that you're in but it wasn't an issue in Canada.

From Down the Rabbit Hole by:

My SM-G930W8 ??
[Samsung Galaxy S 5 Unified Development] wayan_billie:
I was cange my rom,so i can not take the ss
[Samsung Galaxy S 5 Unified Development] wayan_billie:
Like this,how to fix?
[Samsung Galaxy S 5 Unified Development] shaggyskunk:
Yeah I've never seen that.... Are you using VPN? I'm almost certain that I didn't enter my phone number - But I did sign in without VPN

From Down the Rabbit Hole by:

My SM-G930W8 ??
[Samsung Galaxy S 5 Unified Development] reukiodo:
I finally figured out how to make an update.zip at least for GS5 and LOS 14.1. I think I also solved most of the HealthService crashing issues by including a missing libsecure_storage_jni.so from another GS5 (with TouchWiz) into the zip. I'm not sure if this will work with other Samsung devices or even other LOS versions, but feel free to reply to let everyone else know what you have and if it worked for you. Now I'm not sure how to share it since the zip is ~41MB...

I guess I'll just share it from Google Drive:

https://drive.google.com/file/d/0B1pGU044HRD_Q29Wc0w0RndVUGc/view?usp=sharing
[Samsung Galaxy S 5 Unified Development] ShahabJafri:
This worked fine here. Thanks for your effort :)
[Samsung Galaxy S 5 Unified Development] AndyChecker:
Thanks for this thread as I just got this working on lineageos
[Samsung Galaxy S 5 Unified Development] pmdci:
Thank you so much! Incredible how far the community went. When I started using CyanogenMod, the flip cover wouldn't work and we were told that the heart rate sensor would never work. Now there is no reason to ever use the Samsung ROM with the S5.
[Samsung Galaxy S 5 Unified Development] MikeKarakachanov:
S5 Neo Heart & Stress isn't working

So installed the app I followed the instructions but it won't work , I searched but I can't find anything ,does anyone knows how to fix it?

My Device is G903F

Firmware: Unofficial Lineage IS 14.1
[Samsung Galaxy S 5 Unified Development] reukiodo:
Did you try flashing my zip or did you just try the manual instructions?
[Samsung Galaxy S 5 Unified Development] sunilpaulmathew:
[SHEALTH/HEARTRATE/STRESS] [Magisk/Flashable] for LineageOS-14.1

Some useful stuff for you guys...

After some research, I'm managed to get a fully working Samsung health service (which eventually unlocks Heart Rate and Stress measure). No more crashing of health service at all. Available as a recovery zip as well as Magisk Module. Only tested on Official LineageOS-14.1 on kltekor. But should work on other klte variants and LOS based Nougat ROMs as well. See screenshots for more info.

/* How-to */

1. Download Recovery zip or Magisk module (according to your choice)

2. Remove the old HealthService.apk (if any)

3. Install SHealth from play store

4. Go to twrp/Magisk Manager and flash Recovery zip/Magisk Module

5. Reboot and enjoy

PS: If you are already using SHealth, you need to force stop and wipe data/cache of the app to get rid of the old configuration.

Download links and screenshots can be found below. Enjoy...

/* Screenshots */

/* Downloads */

Recovery zip

Magisk Module
[Samsung Galaxy S 5 Unified Development] ShahabJafri:
Last I used Samsung Health on LiOS, I gave up on it after using a month or so because it would cause very high battery usage. SHealth consistently remained in the top battery usage apps and the battery backup showed noticeable improvement after it was removed. Any such experience with this mod [MENTION=7060205]sunilpaulmathew[/MENTION] ?
[Samsung Galaxy S 5 Unified Development] yoahmad1995:
Keep getting this.
[Samsung Galaxy S 5 Unified Development] dferferfer:
I cant activate under "Community" the Device. I get a SMS but 5877 cannot identify device.

I use lineage 14.x in Note 4 (7.1.2)

The Gear App Android s health also cannot find My Gear s - the 7.1.2 system find the Gear and i can Connect viva BT the Device Android Gear but the Samsung Apps cant usw the Gear s :/

Any Idea ?
[Samsung Galaxy S 5 Unified Development] CRAZY Android user:
Same here. I'm using galaxy s5 g900h, the Exynos version.

It's not detecting my heart rate. The red LED is not turning on the heart rate sensor.
[Samsung Galaxy S 5 Unified Development] Raynelfss:
It seems not to work on Oreo. Sadly. :crying:
[Samsung Galaxy S 5 Unified Development] yoahmad1995:
I think Samsung Health uses Safetynet API and our device's kernel doesn't support Safetynet for now.
[Samsung Galaxy S 5 Unified Development] Paul_Lunardi:
Is this working on oreo/lineage 15 unofficial?

Thanks
[Samsung Galaxy S 5 Unified Development] andrea2004:
no, wait
[Samsung Galaxy S 5 Unified Development] LazyGuy1:
I'm currently trying to fix the issue on Android Oreo, which is refusing to enable the Heart rate sensor because of it's missing the following permission:

"com.samsung.permission.SSENSOR"

Till now, you can use the app called "Sensors Test" in the Play Store or install the apk I have attached below. (Same app)

Regards,

Lazy.
[Samsung Galaxy S 5 Unified Development] jizzy001:
is there any progress getting this to work on android 8.1? :confused:
[Samsung Galaxy S 5 Unified Development] Laughitplz:
Hey, OP. I know this isn't the right device to ask, but do you think you can help make this work for the Note 4 Lineage 14.1?
[Samsung Galaxy S 5 Unified Development] andra.soul.catcher:
Niiice..

Confirmed.. Works with kltedcm Lineage OS 14.. Thank you so much..!
[Samsung Galaxy S 5 Unified Development] wutname:
anyone try on LOS 15.1?
[Samsung Galaxy S 5 Unified Development] jizzy001:
Could you redo this with a newer Health Service app (2.1.4.001) pulled from a Galaxy S7 (Stock Oreo)

I'am not forcing anything, just researching if this could work on Oreo maybe?
[Samsung Galaxy S 5 Unified Development] Paul_Lunardi:
Hi there I understand that I've been advised to wait for the driver for S5 Oreo which is fine. Just want to know whether there is a GitHub page where I can follow its progress.

Thanks.
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
I got it working on Oreo!

Tested with Resurrection Remix-OS 6.1.0 [8.1.0_30] on KLTE.

Took me a whole day and it's a dirty solution, but it works. I'm an linux/android noob, so I hope people like [MENTION=7060205]sunilpaulmathew[/MENTION] can improve this fix to make it as convenient as possible.

As [MENTION=8985480]LazyGuy1[/MENTION] already said, the problem is that permission "com.samsung.permission.SSENSOR" is not granted to "com.sec.android.app.shealth".

You can manually fix that by adding

<item name="com.samsung.permission.SSENSOR" package="com.sec.android.app.shealth" />

to the "permissions" section of /data/system/packages.xml.

Just copy the above code in a new line somewhere between the <permissions> </permissions> tags. This survives a restart, no idea if it survives dirty flashes.

To get the app and health services prepared, do this first:

EDIT:

I figured out that SSENSOR permission for service.health works too:

<item name="com.samsung.permission.SSENSOR" package="com.sec.android.service.health"

The best thing is, that we already have to flash the health service with the .zip that [MENTION=7060205]sunilpaulmathew[/MENTION] provided (in the quote). So a little modification to its manifest.xml, and this permission automatically gets put in /data/system/packages.xml when the zip gets flashed in recovery.

So I decoded the HealthService.apk (within Samsung-HealthService-20180105.zip -> \system\priv-app\HealthService) by using apktool. Added

<permission android:description="@string/permission" android:label="SSENSOR" android:name="com.samsung.permission.SSENSOR" android:protectionLevel="dangerous"/>

. And then (re)build the apk using apktool. Then I replaced the HealthService.apk in the .zip with my newly build one and flashed it in the recovery. The sensor now works.

EDIT2:

Use sunilpaulmathew's Magisk module or flashable .zip which can be found on the next page of this thread.

I uploaded this modified HealthService.apk, all you have to do is unzip the Samsung-HealthService-20180105.zip. Go to \system\priv-app\HealthService replace the apk there and zip the two folders (META-INF and system) together. Then flash in recovery.

I could have uploaded the final .zip, but I'm not sure if the owner likes that, since he put (c) sings there, I respect that. I don't know how to make my own flashable zip for now.

Thanks to sunilpaulmathew's permission I uploaded the flashable .zip for all users that don't use Magisk. Just flash it in recovery instead of the recovery.zip in the quote above. But I still recommend using his Magisk module which can be found on the next page. My HealthService.apk is not signed and I don't know if MANIFEST.MF, CERT.SF and CERT.RSA should better be adapted or not. Just use the Magisk module on the next page if you can ;)
[Samsung Galaxy S 5 Unified Development] sunilpaulmathew:
Awesome work friend... really appreciable...

I also got it working on LineageOS-15.1 by following your steps along with my magisk module,

that is by adding the same single line of code "<item name="com.samsung.permission.SSENSOR" package="com.sec.android.app.shealth" />" into "/data/system/packages.xml" somewhere between

<permissions>

</permissions>​

and it survived after a reboot... and it will mostly survive after ROM updates if you won't wipe the /data partition in TWRP.

Let me see how to make it as a flashable zip.

Edit: [MENTION=6075250]MaChiMiB[/MENTION] you can freely use my zip format to make the new flashable zip with the modified apk file. Don't worry about (c) things. You may remove, edit or retain it according to your convenience. Anyway, I already made and post Magsik module of the same with a special mention to your name (see next post).
[Samsung Galaxy S 5 Unified Development] sunilpaulmathew:
Heart Rate for Oreo

Okay guys,

By following the last post of [MENTION=6075250]MaChiMiB[/MENTION] (that is, compiled new apk with the mentioned changes and signed with my personal key), I made a new Magisk module which should work on all the Oreo ROMs for our device. All the credit to him for the basic idea.

Requirements

kltexxx

Android 8.1 (it may not work on Nougat ROMs)

Magisk 15 +

How-to

1. Remove any old version of HealthService.apk and related lib and permission files

2. Force close and clear the data of Samsung Health

3. Download and flash the module in recovery or Magisk

4. Restart and Enjoy

Downloads

Samsung-HealthService-Oreo-Magisk

The source code of the Magisk Module can be found here
[Samsung Galaxy S 5 Unified Development] clockstoper:
Wow! Thanks it works like a charm

Thanks it works like a charm
[Samsung Galaxy S 5 Unified Development] Mihai14:
Will it work on s5 neo (sm g903f) on lineage os 15.1? Or any other samsung device running aosp oreo
[Samsung Galaxy S 5 Unified Development] sunilpaulmathew:
I do not own any other Samsung device running aosp oreo ROMs. It has all the chances to work on devices with a comparable CPU. Why don't you try it out by yourself? It doesn't harm you as long as you have a working backup.
[Samsung Galaxy S 5 Unified Development] Mihai14:
It doesn't seem to work but i can't figure out why.
[Samsung Galaxy S 5 Unified Development] zakijesk:
did you try installing unmodified health services APK then adding with some root explorer the

<item name="com.samsung.permission.SSENSOR" package="com.sec.android.app.shealth" />

to the "permissions" section of /data/system/packages.xml somewhere between the <permissions> </permissions> tags like [MENTION=6075250]MaChiMiB[/MENTION] said and then restart
[Samsung Galaxy S 5 Unified Development] jerfsonpaiva:
Unable to verify phone number in Samsung Health. I tryed everything in this and another foruns and don't work.

The heart monitor works fine, but the veryfication of the account not.
[Samsung Galaxy S 5 Unified Development] Mihai14:
Yes i did. Maybe is because of the rom
[Samsung Galaxy S 5 Unified Development] zakijesk:
but [MENTION=7060205]sunilpaulmathew[/MENTION] got it working on LineageOS-15.1 ?
[Samsung Galaxy S 5 Unified Development] sunilpaulmathew:
Heath Service for Oreo/Flash-able zip

Here I'm adding a recovery flashable zip of the Samsung Health Service, which enables heart rate measurements in Lineage OS and other Android Oreo ROMs for kltexxx, for those who do not want to use Magisk. For general instructions, please refer this post (except the Magisk related stuff). Again, with due credits to [MENTION=6075250]MaChiMiB[/MENTION] for his awesome work...

For those who ask questions about other devices and ROMs, I only tested this mod on my kltekor and LineageOS-15.1. You guys are, however, free to test on any other Oreo ROMs and similar Samsung devices with Snapdragon chips at your own risk... Do not forget to back-up your current ROM, and also update the status here for other users...

Cheers...

Downloads

Samsung Health Service for Oreo (Recovery flashable)
[Samsung Galaxy S 5 Unified Development] mop09737:
It's working, thank you very much :):good:
[Samsung Galaxy S 5 Unified Development] Evaldash:
Worked like a charm on my Nougat rom, thank you very much! :)
[Samsung Galaxy S 5 Unified Development] jerfsonpaiva:
Why they don't include this on the official LOS 14.1 and 15.1 Rom?
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
Because it's a proprietary service api that enables one proprietary app to work. LOS doesn't even integrate google apps. And that's good.
[Samsung Galaxy S 5 Unified Development] kakhak:
What device model do you have? I have Samsung Galaxy S5 (SM-G900H - k3gxx), I flashed this module, installed Samsung Health. It opened without error and there Heart Rate > measure appeared without problem but HR sensor still do not work. I've switched SSENSOR persmission on for Health Service, also for Samsung Health app through the App manager but all the same, sensor wont' work on Nougat v7.1.0 (I tried Resurrection Remix OS/official, Lineage OS/official, Mokee/official).

I tried everything, tried to install Samsung Health firstly, then health service module from here, tried clearing cache, data, force stopping, clearing dalvik cache from TWRP. Nothing helped here.

Do you have some thoughts about how to I can resolve this problem?
[Samsung Galaxy S 5 Unified Development] Ki-8:
Thank You,

It worked good, but with recent version lineage-15.1-20180716-nightly-klte. stopped functioning again.

Any clues what could be wrong? tried to install package again, clearing data, but still nothing.

Device 900F

Worked on lineage-15.1-20180716-nightly-klte just fine

Just flashed recovery flashable version, and it worked,

Thank You
[Samsung Galaxy S 5 Unified Development] Paul_Lunardi:
Yes I can also confirm it to not be working since the latest nightly update.
[Samsung Galaxy S 5 Unified Development] Ki-8:
Actually you should reflash zip after every update.

Actually you should reflash zip after every update.

Also after latest build, changlog says it increased sensors Sensivity, heart rate monitor shows 2x bigger readings in same situation as before
[Samsung Galaxy S 5 Unified Development] Ki-8:
(

Sorry 2x higher reading could be because of my illness this week.
[Samsung Galaxy S 5 Unified Development] saoudien07:
I confirme it is not working on Lineage 15.1, last version.

Maybe the flashable need to be updated??
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
Re-flash the .zip in TWRP. It works. But it seems you have to flash the .zip after every ROM update.
[Samsung Galaxy S 5 Unified Development] yoahmad1995:
Yes, it doesn't survive OTAs
[Samsung Galaxy S 5 Unified Development] saoudien07:
I did not update, just flashed the zip without pb but can not use the sensor.

PS: I am on Lineage 15.1 unofficial, maybe dats the reason??
[Samsung Galaxy S 5 Unified Development] mop09737:
For me is working with last lineage version and yes, I reflash the zip file:good:
[Samsung Galaxy S 5 Unified Development] saoudien07:
It is not working at all now, the start screen can not even open, I mean it should come front the botton of screen and you need to agree and then click continu, it is always trying and trying to come up.

How to remove the service and start frim beginning?? Need to remove cause my fone started to get very hot :eek:
[Samsung Galaxy S 5 Unified Development] sunilpaulmathew:
Hi guys,

Just for a clarification, the health service flashable zip will NOT survive on ROM OTA updates, means you have to reflash the zip file after each update.

However, the survival script in magisk will help to survive the magisk module version of the health service upon OTA updates.

So, either reflash the flashable zip after each OTA update or simply shift to the Magsik Module. Further, if your SHealth app somehow failed to read the sensor (probably after OTA update), you have to force close (and clear data) and re-configure the app to get it to work.

Finally, for those who want to remove the Health Service addon completely, you have to remove the following files (either in Root File Manager or via adb/local terminal).

Please note: You have to do thsi before switching to Magisk version.

/system/priv-app/HealthService/HealthService.apk

/system/vendor/lib/libsecure_storage_jni.so

/system/vendor/lib/libsecure_storage.so

/system/etc/permissions/shealth_sw_pedometer_paused.xml

/system/etc/secure_storage/com.sec.android.service.health/ss_id

/system/etc/secure_storage/com.sec.android.service.health!dex/ss_id
[Samsung Galaxy S 5 Unified Development] saoudien07:
I kind of got lost between the procedure of the OP where need to use the apk and the procedure where the flashable have to be used.

Can somebody tell what I should use ( apk or flashable zip) and also before or after installing S Health from playstore.

Thx.
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
The OP is not up to date and doesn't work on Oreo (and is way too complicated for Nougat).

Install Samsung SHealth from the Playstore, if already installed, force close it and clear its data.

If you got Magisk installed, do this: https://xdaforums.com/showpost.php?p=76999230&postcount=71

OR

If not, use the flashable .zip and reflash this .zip in TWRP every time you updated your ROM: https://xdaforums.com/showpost.php?p=77017583&postcount=80

More info: Step 1: removing an older HeathService.apk and related libs is explained here: https://xdaforums.com/showpost.php?p=77357480&postcount=97
[Samsung Galaxy S 5 Unified Development] saoudien07:
Thx for the procedure, unfortunately I did exactly as you said, even restored a NAndroid backup I did last week to dont have any trace of any Health Service (to can start from zero), and it almost killed me. :crying:

When I run S health, it show me that msg every 5 sec! Can not even use the phone cause everytime I get that msg! So had to remove Samsung Health.

What can I do now??
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
Do you try this on a S7 or S5? Because we're in the S5 forum here. The phones likely use totally different sensors and sensor names.

Do a logcat when the error appears and attach it here. If it's an easy adaptation (e.g. changing the permission name) I might can provide a fix, but I can't promise anything, nor can I test it.
[Samsung Galaxy S 5 Unified Development] saoudien07:
My bad ,I am effectively trying it on S7. I though was the same for all AOSP as the title says, but looking more I realized that the tread is in the rubic of S5...

Thx a lot for the support, and you look into it is already a lot ?

Here is the logcat.

Ps: it is the first time I do it, hope I did it right.
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
Read here how to do a proper logcat: https://www.xda-developers.com/guide-sending-a-logcat-to-help-debug-your-favorite-app/

Your logcat contains only a unrelated warning. You have to execute (or try to execute) the app while recording the logcat.
[Samsung Galaxy S 5 Unified Development] saoudien07:
Hello, sorry for previous logcat.

PS: after insistating bypassing the constant error appearing, the "Heat Rate" and "Stress" record appeared in the S Health app, but nothing is happening probably because S Health service is not working properly...

About the logcat I can not upload all of it here because it always exceeds the max size allowed by the site.

So I choosed the filter option and extracted only "errors". I hope it is ok and informative to resolved the issue.

If no tell me which filter to choose please.

Thx.
[Samsung Galaxy S 5 Unified Development] MaChiMiB:
Frist off, I'm an android coding noob and most things I do are trail and error, so if anybody got more knowledge please contribute here. Maybe I'm just focusing on the visible effects and don't address the root of the problem. I can't test this, because I don't have a Samsung 64bit device, but I searched through this thread and somehow some S7 owners reported that an early version of this mod worked from them on Nougat. So it shouldn't be impossible on Oreo.

java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/priv-app/HealthService/HealthService.apk"],nativeLibraryDirectories=[/system/priv-app/HealthService/lib/arm64, /system/lib64, /system/vendor/lib64, /system/lib64, /system/vendor/lib64]]] couldn't find "libsecure_storage_jni.so"

The error message suggests that it's an 32 vs 64 bit problem. The S5 klte is 32 bit, your S7 is 64 bit.

It seems that the "libsecure_storage_jni.so" file is expected to be in "/system/lib64", but it isn't. So as a quick try you can copy the "libsecure_storage_jni.so" from "/system/lib" to "/system/lib64". Maybe even copy "libsecure_storage.so" too.

To copy the files, you can use a root file explorer app. Or you can use TWRP recovery by first going to "Mount" checking "System", going back, then "Advanced" -> "File Manager".

During .zip installation those files get permission 0644, so after copying them to "/system/lib64" select them and do chmod 0644.

If this doesn't work, send another logcat.