Best Practice for Initializing GroundSDK in an ATAK Plugin Fragment?

I see on the main Parrot USA website that GroundSDK can be integrated with ATAK. (Home > Newsroom > 4 reasons to Combine TAK suite & ANAFI USA)

I’m building off an existing Java-based plugin for ATAK and integrating GroundSDK 7.7.0 due to some project limitations. I have managed to get the SDK working correctly in a standalone test app, but I am facing a fundamental initialization problem within the ATAK plugin architecture.

My core issue is initializing the GroundSDK session from within an ATAK Fragment.

  • The ManagedGroundSdk.obtainSession() helper isn’t an option, as it requires an Activity context which I don’t have in this part of the plugin.
  • Using the direct GroundSdk.newSession(context) call leads to a Catch-22 depending on which context I provide:
    1. Passing the ATAK pluginContext fails internally with a ClassCastException because the SDK can’t get a standard Application object from it.
    2. Passing a standard Android requireContext() fails with a Resources$NotFoundException because the SDK can’t find its own internal configuration files.
  • I have tried workarounds. However they all fail. An attempt to use a separate Activity works for initialization on a small level, but is not a viable solution as it covers the ATAK UI and its lifecycle is temporary.

What is the recommended approach or best practice for initializing the GroundSDK session from within an ATAK plugin Fragment, given these context limitations? Is there a specific configuration needed for this environment? Is there a different SDK that Parrot offers specifically for ATAK?

Just an update in case anyone comes across this in the future.

After extensive troubleshooting, it appears there is no feasible way to initialize GroundSDK from within an ATAK plugin Fragment due to a fundamental architectural conflict with the Context system.

Using the pluginContext provided by the ATAK framework fails with a NullPointerException or ClassCastException. This is because its getApplicationContext() method returns null, and the SDK requires a valid Application object to initialize.

Using a standard Android Activity context (requireContext()) to solve the Application issue fails with a Resources$NotFoundException. This happens because the ATAK plugin is sandboxed, which prevents the SDK from finding its own internal configuration resources.

This means there is no code-level solution to initialize the SDK within the fragment.

The only workaround I found was to launch a separate Activity for the drone controls. This provides a standard Context and allows the SDK to initialize correctly. However, this is a poor user experience, as it completely covers the ATAK map and requires careful lifecycle management, as the Activity is destroyed every time the user navigates back to ATAK.