dariosalvi78 / cordova-plugin-health

Cordova plugin for the HealthKit and Google Fit frameworks
MIT License
174 stars 126 forks source link

openHealthSettings() does not work on Android 14 / HONOR 70. #329

Open BenLaKnet opened 1 week ago

BenLaKnet commented 1 week ago

Hi,

Strange thing with this phone or Android version.

Google Health is a system service, but when I tried to use "openHealthSettings()", it does not work.

isAvailable returns true, but nothing to do with openHealthSettings().

I installed cordova-android 13.

When I installed manually "Google Health Connect", all is running...

dariosalvi78 commented 1 week ago

there may be a bug in the openHealthSettings, I'll need to check on an newish Android phone. If you see anything strange on logcat, please post it here

BenLaKnet commented 1 week ago

When Google Health Connect is not installed, I have this message (with Chrome: chrome://inspect/#devices):

No Activity found to handle Intent { act=androidx.health.ACTION_HEALTH_CONNECT_SETTINGS }

Maybe the Google Health service is ok, but no Intent is defined to show parameters.

BenLaKnet commented 5 days ago

Ok, I tried the pull request, it is running. I do that in my app:

function openHealthSettings() {

    cordova.plugins.health.openHealthSettings(function () {

        console.log("ok");

    }, function (err) {

        console.log(err);
        openHealthInstall();

    });

}

function openHealthInstall() {

    if (cordova.platformId == "android") {

        cordova.InAppBrowser.open("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata", '_system', 'location=yes');

    }
    else if (cordova.platformId == "ios") {

        cordova.InAppBrowser.open("https://apps.apple.com/app/apple-health/id1242545199", '_system', 'location=yes');

    }

}
BenLaKnet commented 3 days ago

Hi @dariosalvi78, Have you published new version of source code? I do not see changes.