Skip to content

Contextual Legacy for Android Support Libraries Integration

Due to the deprecation of Android’s Support Libraries new features will only be added to the AndroidX version of Contextual. If you need any support on this version of Contextual don’t hesitate in contacting us at support@contextu.al .

Requirements

  • Your App Version must be targeted for at least KitKat (4.4) and above
  • minSdkVersion version 19 and above.
  • Contextual uses Java 1.8 features, please make sure your app uses it as well:
    1
    2
    3
    4
    5
    6
    7
    8
    android {
        ...
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        ...
    }
    
  • If you plan to use custom images please ensure you have one of the supported image libraries below:

    1. Glide > 3.x (4.x is supported on Android-X) [recommended]
    2. Picasso == 2.5.2
  • If you are using Proguard please ensure you follow the instructions here

Integration Steps

Include Contextual repositories in your top level build.gradle for all projects.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
allprojects {
    repositories {
        maven {
            url "https://repo.pointzi.com/sdk/pointzi"
        }
        maven {
            url "https://repo.pointzi.com/sdk/streethawk"
        }
    }
}
Include Contextual dependencies in your module/app level build.gradle.
1
2
3
dependencies {
    implementation "com.streethawk:pointzi:1.9.3"
}
Add the following code in your application's launcher activity, replacing ```MyApp``` with the [app_key](/faq/#what-is-my-app-key) from the dashboard.
1
Pointzi.INSTANCE.init(application,  "MyApp");
you can get ```application>``` through the ```getApplication()``` method or ```this```, for example:
1
2
3
4
import com.streethawk.library.pointzi.Pointzi;


Pointzi.INSTANCE.init(getApplication(),  "MyApp");
We recommend you also send a unique ID for the user so you can "tag" users from backend system. This is called the ```cuid```. To do this place the following snippet just after your registration and login calls.
1
2
//unique id in your system, for example customer's login id
Pointzi.INSTANCE.setCuid("user@example.com");
If you use Proguard, please follow instructions in the [Proguard configuation](#proguard-configuration) section below.

Having problems?

Please have a look at our troubleshooting guide.

Proguard configuration.

If you use Proguard, please follow instruction below.

Depending on your ProGuard config and usage, you may need to put the following lines into your proguard-rules.pro file:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
 ### -- Contextual
 -keep class com.streethawk.library.pointzi.** { *;}
 -keep class com.streethawk.library.core.** { *;}

 #### -- Paper On Boarding
 -dontwarn com.ramotion.paperonboarding.R**
 -keepclassmembers class  com.ramotion.paperonboarding.** { *; }


# --- Retrofit2 ---
-dontnote retrofit2.Platform
-dontwarn retrofit2.Platform$Java8
-keepattributes Signature
-keepattributes Exceptions
-dontwarn retrofit2.**
-keep class retrofit2.** { *; }
-keepattributes Signature
-keepattributes Exceptions
-keepattributes *Annotation*
-keepclasseswithmembers class * {
    @retrofit2.http.* <methods>;
}
-keepclassmembernames interface * {
        @retrofit.http.* <methods>;
}
# --- /Retrofit ---

# --- OkHttp + Okio ---
-dontwarn okhttp3.**
-dontwarn okio.**
# --- /OkHttp + Okio ---

# --- Gson ---
# https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg
-keepattributes Signature
-keepattributes *Annotation*
-dontwarn sun.misc.**
-keep class com.google.gson.examples.android.model.** { *; }
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
-keepclassmembers enum * { *; }
# --- /Gson ---

 #### -- Apache Commons --
 -dontwarn org.apache.commons.logging.**

 #### -- Glide ---
 -keep class com.bumptech.glide.**
 -dontwarn com.bumptech.glide.**
 -keep public class * implements com.bumptech.glide.module.GlideModule
 -keep public class * extends com.bumptech.glide.module.AppGlideModule
 -keep public enum com.bumptech.glide.load.resource.bitmap.ImageHeaderParser$** {
    **[] $VALUES;
    public *;
 }

Contextual includes Glide image library dependency

1
implementation 'com.github.bumptech.glide:glide:4.9.0'

Last update: 2023-04-12