Webtrekk Android SDK V5

Overview

Webtrekk Android SDK v5 Build Status

Site | Docs | Support

Webtrekk Android SDK is used to integrate Webtrekk tracking systems with your Android apps. Collect meaningful data about how your apps are used, track how your users interact with your app, how they view specific pages, and custom events. Based on the tracking data from apps different indicators can be measured, which are already known from the web analytics, such as page impressions, events, screen size, operating system, e-commerce tracking, etc.

Webtrekk Android SDK v5 is written entirely in Kotlin and uses Coroutines for non-blocking executions, WorkManager for enqueuing and sending the track requests to optimize the device battery and app performance. Webtrekk internally, collects and caches the data that you specify for tracking, and later, it sends those data to Webtrekk analytic servers in periodic times.

Installation

Gradle

implementation 'com.webtrekk.webtrekksdk:webtrekksdk-android:5.0.4'

Maven

<dependency>
	<groupId>com.webtrekk.webtrekksdk</groupId>
	<artifactId>webtrekksdk-android</artifactId>
	<version>5.0.4</version>
	<type>pom</type>
</dependency>

The SDK requires that you enable Java 8 in your builds.

compileOptions {
        targetCompatibility 1.8
        sourceCompatibility 1.8
}

Allow the network permission in your app manifest.

<uses-permission android:name="android.permission.INTERNET" />

The SDK supports min Android SDK (21).

Note that the SDK uses AndroidX, make sure to migrate your app to AndroidX Migration to avoid Manifest merger failure.

Read more

Check out the docs on the site to learn more about tracking server and custom params. We have implemented camera, push and form tracking in our Test Application

Contributing

Please check out our contributing guide before you start here.

License

MIT License

Copyright (c) 2019 Webtrekk GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • NoClassDefFoundError with Koin 3.1.2 & Webtrekk 5.1.0

    NoClassDefFoundError with Koin 3.1.2 & Webtrekk 5.1.0

    Our app crashes with following example configuration. The same behavior occurs in our live app.

    build.gradle

    plugins {
        id 'com.android.application'
        id 'kotlin-android'
    }
    
    android {
        compileSdkVersion 30
        buildToolsVersion "30.0.3"
    
        defaultConfig {
            applicationId "com.example"
            minSdkVersion 23
            targetSdkVersion 30
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = '1.8'
        }
    }
    
    dependencies {
    	implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    	implementation 'androidx.core:core-ktx:1.6.0'
    	implementation 'androidx.appcompat:appcompat:1.3.0'
    	implementation 'com.google.android.material:material:1.4.0'
    	implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    	testImplementation 'junit:junit:4.+'
    	androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    	androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    	
    	
    	implementation 'com.mapp.sdk:intelligence-android:5.1.0'
    	implementation "io.insert-koin:koin-android:3.1.2"
    }
    

    MainActivity

    package com.example.webtrekk
    
    import androidx.appcompat.app.AppCompatActivity
    import android.os.Bundle
    import webtrekk.android.sdk.Logger
    import webtrekk.android.sdk.Webtrekk
    import webtrekk.android.sdk.WebtrekkConfiguration
    
    class MainActivity : AppCompatActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
    
            val webtrekkConfiguration = WebtrekkConfiguration
                .Builder(
                    trackDomain = MY_TRACK_DOMAIN,
                    trackIds = MY_TRACK_IDS
                )
                .disableActivityAutoTracking()
                .disableAutoTracking()
                .disableFragmentsAutoTracking()
                .logLevel(Logger.Level.BASIC)
                .build()
    
            Webtrekk.getInstance().init(this, webtrekkConfiguration)
        }
    
        companion object {
            val MY_TRACK_DOMAIN = ""
            val MY_TRACK_IDS = listOf<String>()
        }
    }
    

    Logcat output:

        java.lang.NoClassDefFoundError: Failed resolution of: Lwebtrekk/android/sdk/core/CustomKoinComponent;
            at webtrekk.android.sdk.Webtrekk.<clinit>(Unknown Source:0)
            at com.example.webtrekk.MainActivity.onCreate(MainActivity.kt:25)
            at android.app.Activity.performCreate(Activity.java:8086)
            at android.app.Activity.performCreate(Activity.java:8074)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3755)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3961)
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91)
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149)
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386)
            at android.os.Handler.dispatchMessage(Handler.java:107)
            at android.os.Looper.loop(Looper.java:213)
            at android.app.ActivityThread.main(ActivityThread.java:8178)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
         Caused by: java.lang.ClassNotFoundException: webtrekk.android.sdk.core.CustomKoinComponent
            at java.lang.VMClassLoader.findLoadedClass(Native Method)
            at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            at webtrekk.android.sdk.Webtrekk.<clinit>(Unknown Source:0) 
            at com.example.webtrekk.MainActivity.onCreate(MainActivity.kt:25) 
            at android.app.Activity.performCreate(Activity.java:8086) 
            at android.app.Activity.performCreate(Activity.java:8074) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3755) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3961) 
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) 
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) 
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386) 
            at android.os.Handler.dispatchMessage(Handler.java:107) 
            at android.os.Looper.loop(Looper.java:213) 
            at android.app.ActivityThread.main(ActivityThread.java:8178) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101) 
         Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/koin/core/KoinComponent;
            at webtrekk.android.sdk.Webtrekk.<clinit>(Unknown Source:0) 
            at com.example.webtrekk.MainActivity.onCreate(MainActivity.kt:25) 
            at android.app.Activity.performCreate(Activity.java:8086) 
            at android.app.Activity.performCreate(Activity.java:8074) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3755) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3961) 
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) 
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) 
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386) 
            at android.os.Handler.dispatchMessage(Handler.java:107) 
            at android.os.Looper.loop(Looper.java:213) 
            at android.app.ActivityThread.main(ActivityThread.java:8178) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101) 
         Caused by: java.lang.ClassNotFoundException: Didn't find class "org.koin.core.KoinComponent" on path: DexPathList[[zip file "/data/app/com.example.webtrekk-FD0n8K6ogBrjNCzTm54dRg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.webtrekk-FD0n8K6ogBrjNCzTm54dRg==/lib/arm64, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64, /prets/lib64]]
            at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            at webtrekk.android.sdk.Webtrekk.<clinit>(Unknown Source:0) 
            at com.example.webtrekk.MainActivity.onCreate(MainActivity.kt:25) 
            at android.app.Activity.performCreate(Activity.java:8086) 
            at android.app.Activity.performCreate(Activity.java:8074) 
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1313) 
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3755) 
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3961) 
            at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) 
            at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) 
            at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2386) 
            at android.os.Handler.dispatchMessage(Handler.java:107) 
            at android.os.Looper.loop(Looper.java:213) 
            at android.app.ActivityThread.main(ActivityThread.java:8178) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101) 
    
    bug 
    opened by ImpYoo 6
  • [BUG] Webtrekk Sdk not working with target API Level 31 (Android 12)

    [BUG] Webtrekk Sdk not working with target API Level 31 (Android 12)

    Describe the bug If the compileSdk and targetSdk is set to api level 31 (Android 12) the app that uses this SDK won't build anymore. The build fails with the following error:

    java.lang.IllegalArgumentException: <package_name>: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
       Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
           at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
           at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
           at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
           at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:174)
           at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:108)
           at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:86)
           at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
    

    To Reproduce Steps to reproduce the behavior:

    1. Set compileSdk and targetSdk to api level 31
    2. And add the latest webtrekk sdk
    3. Build your app

    The Build is failing with the above error message. It's because androidx.work:work-runtime dependency needs to be updated to 2.7.0, I think.

    Smartphone (please complete the following information):

    • Device: Pixel 5
    • OS: Android 12 (API Level 31)
    • WebtrekkVersion 5.1.0.2

    Additional context I've did a test to force the usage of androidx.work:work-runtime:2.7.0 by adding the following snippet to the root build.gradle file:

    allprojects {
        .
        .
        
        project.configurations.all {
            resolutionStrategy {
                force 'androidx.work:work-runtime:2.7.1'
            }
        }
    }
    

    You may have to include also 'androidx.work:work-runtime-ktx:2.7.1' or use 'androidx.core:core-ktx:1.7.0' After that the build passed and I could start and use the app. Not sure if that is all you need to support android 12 but it would be great to get a fix for this asap. :)

    Hope it helps!

    Best regards,

    Josef

    opened by Vall0n 4
  • Could not find org.koin:koin-android:2.1.5.

    Could not find org.koin:koin-android:2.1.5.

    Describe the bug After including the newest version (5.0.8) in our dependencies block (dependencies { implementation 'com.mapp.sdk:intelligence-android:5.0.8' }) we get the following error during a Gradle build:

    > Could not resolve all files for configuration ':****'.
       > Could not find org.koin:koin-android:2.1.5.
         Searched in the following locations:
           - https://dl.google.com/dl/android/maven2/org/koin/koin-android/2.1.5/koin-android-2.1.5.pom
           - https://repo.maven.apache.org/maven2/org/koin/koin-android/2.1.5/koin-android-2.1.5.pom
           - https://jitpack.io/org/koin/koin-android/2.1.5/koin-android-2.1.5.pom
         Required by:
             project :APAWLApp > com.mapp.sdk:intelligence-android:5.0.8
    

    According to the error, the above mentioned koin version cannot be found on maven central.

    The developers of koin recently changed the maven central group id from org.koin to io.insert-koin [1] so this build error probably results from the renaming.

    [1]: https://github.com/InsertKoinIO/koin#maven-central, 21.05.2021, HEAD d9fdc2266d03ac64c6e7c3946046a052993d8dae

    enhancement 
    opened by juliankotrba 4
  • Activity Tracking still present even if disabled via Configuration

    Activity Tracking still present even if disabled via Configuration

    Describe the bug In the tracking console, we see Activity tracking even if disableAutoTracking() is called on the Configuration Builder.

    To Reproduce Steps to reproduce the behavior:

    1. Build a Webtrekk Instance with the following config:
    WebtrekkConfiguration
       .Builder(
          trackDomain = getTrackDomain(),
          trackIds = getTrackIds()
       )
       .disableAutoTracking()
       .enableMigration()   
       .logLevel(logLevel)
       .okHttpClient(okHttpClient)
       .setBatchSupport(true)
       .build()
    
    1. Start and run the app
    2. Check the logs in the Webtrekk console

    Smartphone (please complete the following information):

    • Device: Several Android devices
    • OS: Android 8.0 -11
    • WebtrekkVersion: 5.1.1-beta1

    Additional context Please check webtrekk.android.sdk.core.AppStateImpl and webtrekk.android.sdk.module.InjectionModule.provideAppState(). TheAppState is missing where both Fragment and Activity tracking are suppressed.

    opened by sbos5e 3
  • startKoin() called in SDK

    startKoin() called in SDK

    Description If an Android app uses Koin for DI it is not possible embed this SDK without errors. The SDK uses startKoin() during intialization. This should normally happen in the onCreate() of the Application class in the app itself. See: https://insert-koin.io/docs/2.0/documentation/reference/index.html#_the_startkoin_function

    Possible fix Please switch to loadKoinModules

    bug 
    opened by sbos5e 2
  • Potential issue with devices below API 21, due to OkHttp 3.13.+ requirements.

    Potential issue with devices below API 21, due to OkHttp 3.13.+ requirements.

    The SDK uses OkHttp 3.13.+, which requires:

    • Android 5.0+ (API 21+)
    • Java 8+

    Since the SDK supports min API 15, it's an issue using the SDK with devices below API 21.

    good first issue 
    opened by Neno0o 0
  • No release notes for 5.1.4.1

    No release notes for 5.1.4.1

    Our dependency update tool reported about the 5.1.4.1 version of Webtrekk but there is no changelog nor release notes yet.

    Is this a stable release or a SNAPSHOT?

    opened by dawidhyzy-ifolor 1
Releases(5.1.5)
Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)

storyblok-mp-SDK-blog ... a showcase of using the Storyblok Kotlin Multiplatform Client to build a blog application (Android, JVM) What's included ??

Mike Penz 5 Sep 28, 2022
Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Kotlin Multiplatform is an SDK for cross-platform mobile development, which enables teams to use the same business logic in both Android and iOS client applications.

Chris Russell 1 Feb 11, 2022
Android sample app for mobile-sdk integration

Dyte Android Sample App An example app in kotlin using the Dyte Mobile Core SDK Explore the docs » View Demo · Report Bug · Request Feature Table of C

Dyte 5 Jul 30, 2022
io.github.jakob.AgonesClient - Kotlin client library for sdk.proto

io.github.jakob.AgonesClient - Kotlin client library for sdk.proto Requires Kotlin 1.3.41 Gradle 4.9 Build First, create the gradle wrapper script: gr

KunJakob 3 Jun 24, 2022
Unofficial Actions on Google SDK for Kotlin and Java

Actions On Google Client Library This is a port of the official Node.js SDK to Kotlin. This can also be used from Java and any JVM language. Quick Fac

Ticketmaster® & Live Nation Entertainment® 118 Oct 3, 2022
Account-lib - A suite of libraries to facilitate the usage of account-sdk

Usage Clone this repository (skip this step if the repo is on your local machine). The default branch is fine. git clone https://github.com/AFBlockcha

null 0 May 24, 2022
The AppMetrica Push SDK is a set of libraries for working with push notifications.

Flutter AppMetrica Push AppMetrica Push SDK — это набор библиотек для работы с push-уведомлениями. Подключив AppMetrica Push SDK, вы можете создать и

Mad Brains 6 Oct 12, 2022
Android MVVM framework write in kotlin, develop Android has never been so fun.

KBinding 中文版 Android MVVM framework write in kotlin, base on anko, simple but powerful. It depends on my another project AutoAdapter(A library for sim

Benny 413 Dec 5, 2022
Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android.

Klimatic Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android. Built using Android Architectu

Shivam Satija 34 Oct 11, 2022
Oratio Library for Android Studio helps you simplify your Android TTS codes

Oratio Oratio is a library for Android Studio. This library is useful to a number of developers who are currently making apps using android TTS(Text-T

Jacob Lim 1 Oct 28, 2021
This is a demo android app representing implementation of SE principles in android app development

Articles Demo This repository contains a sample Android App that shows most popular articles data from NY Times API. This is a sample app that shows h

Waesem Abbas 2 Jan 20, 2022
Android-Boilerplate - Base project for android development with new technology

Android-Boilerplate Base project for android development with new technology, in

Muhammad Rizky Arifin 1 Aug 15, 2022
Gits-android-extensions - A collection of Kotlin extensions to simplify Android development

gits-android-extensions A collection of Kotlin extensions to simplify Android de

GITS Indonesia 3 Feb 3, 2022
Android Clean Architecture in Rorty is a sample project that presents modern, approach to Android application development using Kotlin and latest tech-stack.

Android Clean Architecture in Rorty is a sample project that presents modern, approach to Android application development using Kotlin and latest tech-stack.

Mr.Sanchez 176 Jan 4, 2023
Android Ptrace Inject for all ABIs and all APIs. Help you inject Shared Library on Android.

Android Ptrace Inject 中文可以参考我的注释内容进行理解 我写的注释相对来说比较全面了 How to build Make sure you have CMake and Ninja in your PATH Edit CMakeLists.txt. Set ANDROID_ND

SsageParuders 65 Dec 19, 2022
Pleasant Android application development

⚠️ Anko is deprecated. Please see this page for more information. Anko is a Kotlin library which makes Android application development faster and easi

Kotlin 15.9k Jan 5, 2023
YouTube Player library for Android and Chromecast, stable and customizable.

android-youtube-player android-youtube-player is a stable and customizable open source YouTube player for Android. It provides a simple View that can

Pierfrancesco Soffritti 2.9k Jan 2, 2023
A highly customizable calendar library for Android, powered by RecyclerView.

CalendarView A highly customizable calendar library for Android, powered by RecyclerView. With this library, your calendar will look however you want

Kizito Nwose 3.4k Jan 3, 2023
View "injection" library for Android.

Kotter Knife Deprecated: This was a terrible idea because it allocates an object for every view reference. Do not use, and do not use anything like it

Jake Wharton 2.2k Dec 28, 2022