Skip to content

usage on Android #3929

Open
Open

Description

How can this be used in Android applications now that ApplicationInsights-Android has been deprecated?
Specifically configuring the connection string is a bit non-Android. On Android you don't typically set environment variables, or put Json config files next to your appinsights jar file as there are no jar files in the end.

Activity

  1. geoffrey-vl commented on Oct 23, 2024

    @geoffrey-vl
    Author

    For now I have something in line of this:

    build.gradle:

    dependencies {
        ....
        implementation "com.microsoft.azure:applicationinsights-core:3.6.1"
        implementation "com.microsoft.azure:applicationinsights-runtime-attach:3.6.1"
        ....
    }
    

    Java:

    private static final String SYSPROP_CONN_STRING = "applicationinsights.connection.string";
    
    // setup
    System.setProperty(SYSPROP_CONN_STRING, connString);
    com.microsoft.applicationinsights.attach.ApplicationInsights.attach();
    
    // use
    TelemetryClient client = new TelemetryClient();
    client.trackEvent("somedata");
    client.flush();

    It fails however due to missing Java Optional class (java.lang.NoClassDefFoundError: Failed resolution of: Ljava/util/Optional;). Our target platform is still running Android 5.

  2. mihai-chirodea-qubiz commented on Jul 17, 2025

    @mihai-chirodea-qubiz

    Any news on this front? I've been trying to figure out a way to handle logging on android for app insights.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions