annotations

Annotations for the Mixpanel library for Android http://mixpanel.com/android-analytics/

License

License

The Apache Software License, Version 2.0
GroupId

GroupId

com.mixpanel.android
ArtifactId

ArtifactId

annotations
Last Version

Last Version

0.1.0-RC1
Release Date

Release Date

Type

Type

jar
Description

Description

annotations
Annotations for the Mixpanel library for Android http://mixpanel.com/android-analytics/
Project URL

Project URL

https://github.com/mixpanel/mixpanel-android
Source Code Management

Source Code Management

http://github.com/mixpanel/mixpanel-android-build

Download annotations

How to add to project

<!-- https://jarcasting.com/artifacts/com.mixpanel.android/annotations/ -->
<dependency>
    <groupId>com.mixpanel.android</groupId>
    <artifactId>annotations</artifactId>
    <version>0.1.0-RC1</version>
</dependency>
// https://jarcasting.com/artifacts/com.mixpanel.android/annotations/
implementation 'com.mixpanel.android:annotations:0.1.0-RC1'
// https://jarcasting.com/artifacts/com.mixpanel.android/annotations/
implementation ("com.mixpanel.android:annotations:0.1.0-RC1")
'com.mixpanel.android:annotations:jar:0.1.0-RC1'
<dependency org="com.mixpanel.android" name="annotations" rev="0.1.0-RC1">
  <artifact name="annotations" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.mixpanel.android', module='annotations', version='0.1.0-RC1')
)
libraryDependencies += "com.mixpanel.android" % "annotations" % "0.1.0-RC1"
[com.mixpanel.android/annotations "0.1.0-RC1"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Mixpanel Build Tools for Android

This project contains tools that make it easier to to integrate Mixpanel into your application using Gradle and Android Studio.

Mixpanel Tweaks Annotations

Mixpanel Tweaks are a way for you to A/B test different settings and configuration values in your application. You can use tweaks directly in your code using the Mixpanel library, but you can also take advantage of tweaks using the @Tweak annotation on your Java methods.

To use @Tweak, annotate a public method of a public class in your code like this:

import com.mixpanel.android.build.Tweak;

public class MyGreatClass {
    public MyGreatClass() {
        mixpanel.registerForTweaks(this);
    }

    @Tweak(name="greeting")
    public void setGreeting(String greeting) {
        ...
    }
    ...
}

That's it!

Building with Tweak Annotations

Tweak annotations are currently supported in Gradle and Android Studio via a Gradle plugin.

To add Tweak annotations to your build, add the following buildscript dependency to your build.gradle file

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        // Add the line below as a dependency of your buildscript
        classpath 'com.mixpanel.android:annotations-compiler:0.1.0'
    }
}

This adds the annotations compiler tools to the classpath that gradle will use when finding plugins and running it's own scripts. The buildscript dependencies are different from the dependencies of your app - they're for build time only.

Then, apply the Mixpanel annotations plugin to your project by adding the following line to your gradle file

apply plugin: 'mixpanel-android-annotations'

That's all you have to do! The mixpanel-android-annotations plugin will use your annotations and call your methods when new tweak values are received from the Mixpanel API.

Setting custom default values

Tweaks can be set on any public method that takes a single String, double, long, or boolean argument. You can set up defaults in your code using @BooleanDefault, @DoubleDefault, @LongDefault, or @StringDefault. For example

import com.mixpanel.android.build.Tweak;
import com.mixpanel.android.build.LongDefault;

public class MyOtherGreatClass {
    @Tweak(name="Number of Pages to Show")
    @LongDefault(4)
    public void setNumberOfPages(long pages) {
        ...
    }
}
com.mixpanel.android

Mixpanel, Inc

Powerful, self-serve product analytics to help you convert, engage, and retain more users.

Versions

Version
0.1.0-RC1
0.1.0-BETA03
0.1.0-BETA02
0.1.0-BETA01