Mobile & iOS SDK

SurveySparrow’s Mobile SDK lets you embed your surveys in your native Android apps. With today's mobile-driven population, gauging your customers for feedback from your mobile application is a surefire way to increase survey response rates, and gain the insights you need.

For instance, let's say you own an app for movie streaming, and you want to provide a more personalized experience and viewing recommendations to your viewers. To understand your viewers' likes and dislikes, you can ask them to rate a movie/documentary after they have finished watching it. By doing so, you can understand each viewer's preferences and interests, which can further help you in providing personalized movie recommendations.

By using SurveySparrow’s Mobile SDK, you can trigger a survey in your app using just a few lines of code, and analyze all the results in SurveySparrow's reporting module.

Let’s see how it works:

  1. Create a movie review survey and include a Rating question. Navigate to Share.

  2. Select Mobile SDK from the list of sharing channels.

  3. Copy the token.


Now, let’s move on to the coding part:

Mobile SDK - Android Version

Add SurveySparrow’s Android SDK to your app

Add it in your root build.gradle at the end of repositories:

allprojects { repositories { ... maven { url '' } } }

Add the following line to your app modules build.gradle file inside dependencies:

implementation 'com.github.surveysparrow:surveysparrow-android-sdk:0.4.0'

Add permissions

The SDK uses the internet to fetch surveys and submit responses to SurveySparrow. Add internet permissions in your AndroidManifest.xml file.

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

Create and show a survey(using Kotlin)

You can trigger a survey anywhere from your application at any time.

Here’s how:

  1. Create a survey.

    val survey = SsSurvey(" company domain)", "sdk-token")

2. Configure the SurveySparrow object.

val surveySparrow = SurveySparrow(this, survey)

3. Start the movie review survey.


RATE_MOVIE_REQUEST is an integer constant that is passed to identify the request. The ‘startSurveyForResult’ function triggers an inbuilt ‘startActivityResult’ and it can be called multiple times so that the constant can be used to identify the result in the ‘onActivityResult’ handler.

4. Handle survey responses.

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if(requestCode == RATE_MOVIE_REQUEST) { if(resultCode == Activity.RESULT_OK) { // Get the survey response val response = SurveySparrow.toJSON(data?.data.toString()) val responseData = response.getJSONArray("response") val rating = responseData.getJSONObject(0).getInt("answer") // Show a recommendation page if the user give 4+ rating if(rating >= 4) { startActivity(Intent(this, } else { finish() } } else { Log.v(LOG_TAG, "Review survey not completed!") } } }

This code block will be executed once the survey has been submitted or left incomplete. Once the survey is completed, and the rating given is 4 and above, respondents will be directed to a recommendations page. If the rating given is below 4, respondents will be redirected to the home page of the app.

If a respondent leaves the survey incomplete, a ‘Review survey not completed!’ message will be displayed on the console.

Note: The developer can parse the responses and customize the behavior however they want.

Mobile SDK - iOS Version

SurveySparrow iOS SDK enables you to collect feedback directly from your mobile app. Embed the Classic, Chat & NPS surveys in your iOS application seamlessly with just a few lines of code.

Add SurveySparrow’s iOS SDK to your app

Add SurveySparrowSdk Framework to your project either by two ways.

  • Using CocoaPods

  • Directly import SurveySparrowSdk without CocoaPods

Using CocoaPods

Add the following line to your Podfile file under target

pod 'SurveySparrowSdk', :git => '', :tag => '0.2.0'

Importing SurveySparrowSdk directly without using CocoaPods

Add SurveySparrowSdk.xcodeproj or SurveySparrowSdk.framework to your project.

Creating and showing a survey

You can trigger a survey anywhere from your iOS application at any time.

Here's how:

  1. Create a survey

Import the framework

import: SurveySparrowSdk

Create a SsSurveyViewController

let ssSurveyViewController = SsSurveyViewController()

2. Configure the SurveySparrow object

Configure a SsSurveyViewController domain and token

Use the created SsSurveyViewController and set domain and token

ssSurveyViewController.domain = "<account-domain>" ssSurveyViewController.token = "<sdk-token>"

3. Start the survey

Present the SsSurveyViewController

present(ssSurveyViewController, animated: true, completion: nil)

4. Handle the survey responses

Implement the SsSurveyDelegate protocol to handle survey responses.

class ViewController: UIViewController, SsSurveyDelegate { //... func handleSurveyResponse(response: [String : AnyObject]) { // Handle response here print(response) } //... }

Also set surveyDelegate property of the SsSurveyViewController object to self

ssSurveyViewController.surveyDelegate = self


Passing data

To offer more personalization, the movie name can be passed as data from your app to your survey by using Custom Variables.

Here’s how:

  1. Click on the Global Variables icon on the left-sidebar on your survey, and create a variable called ‘movieName’.

2. Use this variable in your Rating question by clicking the dollar sign($) next to the question.

3. Now, use the addCustomParam method in your survey object to share values from your app to the survey.

For Android

survey.addCustomParam("movieName", "Sparrow Life")

For iOS

Passing custom variables to the survey

Add custom params to a SsSurveyViewController

Use the created SsSurveyViewController and set params

var params = [String: String]() params["movieName"] = "Sparrow Life"; ssSurveyViewController.params = params;


You can style your survey to match the theme of your app by using Custom CSS. Paste the following code in the Advanced Editor. This will hide the bottom navigator, progress button, and password warning message in the survey.

.ss_classic_footer_right_content_wrap { visibility: hidden; } .ss_cl_survey_submit_resp > p { visibility: hidden; } .ss-progress-container--new { visibility: hidden; }

You can further customize your survey by removing the SurveySparrow branding and by adding your custom logo.


Other configurations

If you are planning to collect multiple reviews from the same viewer for different movies in your app, you can do so by enabling the ‘Allow multiple submissions per user’ option under Survey Settings(Go to Config > General Settings).


You can find the full code of the Movie App here. For the full SDK documentation, please visit

For iOS SDK documentation, please visit

That's it!

Please reach out to us anytime if you're stuck. Will be happy to assist :)

Did this answer your question?