> For the complete documentation index, see [llms.txt](https://docs.tryterra.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tryterra.co/faq/help-topics/data-api-sdk/mobile-sdk-setup-permissions-and-crashes/init-sequence-before-data-calls.md).

# Why do SDK data calls say permission not granted?

**Data functions like `getActivity` / `getDaily` only work after the SDK is fully initialised.**

{% stepper %}
{% step %}
Call `initTerra()`. This should run on every app launch.
{% endstep %}

{% step %}
Call `initConnection()` with an auth token generated from your backend, which triggers the permissions flow.
{% endstep %}
{% endstepper %}

`initConnection` only needs to run once per install, unless you expand permissions or the app is reinstalled.

`Not connected to Health Connect` / `permission not granted` errors usually mean a data call ran before init completed. Confirm the connection with `getUserId()`: a non-null user id means the connection is established. See the [Android SDK reference](https://docs.tryterra.co/reference/health-and-fitness-api/sdk-references/android-kotlin).
