Android SDK

Gives access to all Critizr features for your Android apps

📘

The Android SDK allows you to:

  • Open a Store Locator interface
  • Or, for a given point of sale :
    • Opening a feedback submission interface
    • Obtaining the customer relationship score
    • Obtaining the satisfaction score
    • Display the Store Display

Installation

Manually

  1. Download the pre-production or production SDK
  2. Adds the file into a libs/ folder in your module's root.
  3. Add the following line to the dependencies part of your module's build.gradle by replacing [env] and [version] with those in your downloaded SDK:
repositories {
       flatDir {
           dirs 'libs'
       }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.aar'])
    }

Implementation

  • Check to ensure that the following permissions are included in your Manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  • Add the following activity to your Manifest file:
<activity android:name="com.CritizrSDK.CritizrActivity"/>
  • Retrieves an instance of CritizrSDK using your Critizr API Key. You will call the different SDK methods from this instance:
CritizrSDK critizrSDK = CritizrSDK.getInstance("<API_KEY>");

🚧

Security configuration

Beware the part <API_KEY> might be changed with you own API_KEY provided by Critizr team.

Demo

You can download a sample that illustrates the different usage cases for the SDK.

Screenshots

References

class CritizrSDK

public void openFeedbackActivity(Context context, CritizrListener aListener, JSONObject parameters)

Launches the Store Locator interface in a new activity. The customer is thus invited to choose the point of sale to which the feedback should be sent.

This activity is linked to a CritizrListener, which will listen for related events.

critizrSdk.openFeedbackActivity(this, this, null);

🚧

Point of sale ID

Beware variable posId have to be change by the id of the point of sale you would like the information to be registered on.

public void openFeedbackActivity(Context context, CritizrListener aListener, string posId, JSONObject parameters)

Launches the Feedback Submission Interface in a new activity for the point of sale given by posId. This activity is linked to a CritizrListener, which will listen for related events.

critizrSdk.openFeedbackActivity(this, this, "posId", null);

public void openStoreDisplayActivity(Context context, CritizrListener aListener, String posId, JSONObject parameters)

Launches the Store Display interface in a new activity.

critizrSdk.openStoreDisplayActivity(this, this, "posId", null);

public void getPlaceRating(String posId CritizrListener aListener)

Allows you to retrieve the customer relationship score attributed to a point of sale with ID posId. This method is asynchronous, in that, when the customer relationship score is retrieved, the [onRatingResult] method of the CritizrListener is called.

critizrSdk.getPlaceRating("posId", this);

CritizrListener Interface

Your activity (or any other application class) can implement the CritizrListener interface. As such, it can be called via the following methods:

public void onFeedbackSent()

Method called when the feedback submission interface has completed successfully (i.e., a comment has been submitted).

public void onRatingResult(double customer_relationship_rating, double satisfaction_rating)

Method called in response to CritizrSDK's getPlaceRating method. customer_relationship_rating thus corresponds to the customer relationship score, and satisfaction_rating to the satisfaction score of the point of sale you specified.

public void onRatingError()

Method called in case of error when trying to call the getPlaceRating method of CritizrSDK.

Practical example

import com.CritizrSDK.CritizrListener;
import com.CritizrSDK.CritizrSDK;

public class MainActivity extends AppCompatActivity implements CritizrListener {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Toolbar toolbar = findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        JSONObject object = new JSONObject();
        try {
            object.put("mode", "quiz");
            object.put("user", "TWljaGFlbHxTY290dHxtaWNoYWVsLnNjb3R0QGR1bmRlcm1pZmZsaW4uY29tfDAxMjM0NTY3ODl8MTIzQUJD");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        CritizrSDK critizrSDK = CritizrSDK.getInstance("<API_KEY>");
      
        // Collect part
        // Launch a modal to display the Store Locator
        // It is possible to launch the modal without parameter by passing NULL instead of the object:
        critizrSDK.openFeedbackActivity(this, this, object);
      
        // Launch a modal to send feedback to the "<posId>" "velo-brest" point of sale:
        // It is possible to launch the modal without parameter by passing NULL instead of the object:
        critizrSDK.openFeedbackActivity(this, this, "velo-brest", object);
      
       // Showcase part
       // Launch a modal to display the Store Display to the "<posId>" "velo-brest" point of sale:
        critizrSDK.openStoreDisplayActivity(this, this, "velo-brest", object);
      
        //To retrieve the ratings related to the point of sale:
        critizrSDK.getPlaceRating("velo-brest", this);
    }
    @Override
    public void onFeedbackSent() {
    }
    @Override
    public void onRatingResult(double customer_relationship_rating, double satisfaction_rating) {
        //The Customer Relationshio Score:
        Log.d("INFO", Double.toString(customer_relationship_rating));
        //The Satisfaction Score:
        Log.d("INFO", Double.toString(satisfaction_rating));
    }
    @Override
    public void onRatingError() {
        Log.e("ERROR", "An error occured.");
    }
}