Class HealthConfigurationException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.codename1.health.HealthConfigurationException

public class HealthConfigurationException extends RuntimeException

Thrown when the app is missing build configuration that the health APIs cannot work without -- an absent ios.NSHealthShareUsageDescription build hint, a missing Health Connect privacy-policy declaration.

Why this is unchecked, when everything else is an AsyncResource failure

An unsupported platform is a runtime fact that a correct app must handle gracefully, so it arrives as a HealthException through an AsyncResource. A missing usage description is a developer bug that gets the app rejected from the App Store, and it must therefore be impossible to swallow into an error callback nobody logs. It follows the precedent set by LocationManager on iOS, which throws with the exact name of the build hint to add.

Health.getConfigurationProblems() returns the same diagnostics without throwing, so a diagnostics screen or a unit test can assert on them.

  • Constructor Details

    • HealthConfigurationException

      public HealthConfigurationException(String message)
      Creates an exception whose message should name the exact build hint to add and describe what to put in it.