This topic describes how to use Log Service SDK for Android to collect logs.

Prerequisites

Log Service SDK for Android is installed. For more information, see Install Log Service SDK for Android.

Sample code

In the following example, download a source code project from GitHub and create an Android app in the Android development environment to collect logs from Android systems.

  1. Download source code files for the app from GitHub.
  2. In the Android development environment, create a project and import the files.
  3. Run the app.
    Run the following command to run the app:
    ./gradlew :app:installDebug
  4. Configure the app to collect logs.
    Click the button for sending logs. Then, logs are automatically sent from Android systems to the specified Logstore.

For more information about sample code, see aliyun-log-android-sdk.