Android SDK

What is the minimum required Android version?

The minimum Android version required is 21. Also, the compile SDK version version for android is 34 (But you should generally compile with the latest version)


Include CX SDK into your project

arrow_rightIntegration From Maven Repository

                The SDK is available on the central Maven repository. Add it in your root settings.gradle.
                    dependencyResolutionManagement {
	                    repositories {
		                    ...
		                    maven { url 'https://jitpack.io' }
	                    }
                    }
            
            
                Add a reference to the latest version of QuestionPro SDK in your app's build.gradle. 
                    dependencies {
                        implementation 'com.github.surveyanalyticscorp:android-cx:labs_2.0'
                    }
                    

Modify your manifest

arrow_rightAdd following permissions

                      <uses-permission android:name="android.permission.INTERNET"/>
                      <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
                
arrow_rightAdd API Key

                          Add the api key obtained from QuestionPro portal:
                            <meta-data android:name="cx_manifest_api_key" android:value="your api key here"/>
                    
arrow_rightAdd the following activity to show the feedback screen

                            <activity android:name="com.questionpro.cxlib.interaction.InteractionActivity"
                                      android:theme="@android:style/Theme.Translucent.NoTitleBar"
                                      android:configChanges="keyboardHidden"
                                      android:windowSoftInputMode="adjustPan"/>
                                
                        

Add TouchPoint hook in app codebase

arrow_right Initialization of SDK and launch feedback Survey

                    You have to initialize the SDK in the Main Activity, For example:
                    
                        TouchPoint touchPoint=new TouchPoint.Builder(DataCenter.US).build();
                        QuestionProCX.getInstance().init(this, touchPoint, new IQuestionProInitCallback() {
                        	@Override
	                        public void onSuccess(String message) {
		                        Log.d(TAG, "onSuccess: "+message);
	                        }
	                        
	                        @Override
	                        public void onFailed(String error) {
		                        Log.d(TAG, "onFailed: "+error);
	                        }
	                
	                        @Override
	                        public void getSurveyUrl(String url) {
		                        Log.d(TAG, "Survey url: "+url);
	                        }

                        });
                        
                    (TouchPoint constructor requires Data Center as a default parameter)
                        
                    
arrow_right Reset the SDK(Important)

                    You have to reset the QuestionPro's intercept SDK just before your app getting closed. Generraly, 
                    you can do it in the onDestroy() method of your applications main activity. 
Please note that, onDestroy() is not guaranteed to execute due to system kills, app crashes, or explicit process termination. QuestionProCX.getInstance().clearSession();