Download surveys

These are optional implementations when downloading Sense360 surveys.

Survey download delegate

The Download delegate receives surveys whenever the SDK downloads them. These surveys may be displayed within the application interface (UI) to be consistent with the other survey displayed within the application

To listen and receive surveys, implement a new Sense360SurveyDownloadDelegate to catch the Intent that includes the downloaded survey object.

import SenseQuinoaLib
class ViewController: UIViewController, Sense360SurveyDownloadDelegate {
@IBOutlet weak var lblSurveyTitle: UILabel!
@IBOutlet weak var btnLaunchSurvey: UIButton!

override func viewDidLoad() {
super.viewDidLoad()
updateStartStopButton()

self.lblSurveyTitle.text = ""
self.btnLaunchSurvey.isEnabled = false

Sense360.addNewSurveyListener(self)
}
// Handles the survey by calling this function when the SDK has detected a survey from the back-end.
func handleNewSurvey(newSurvey: Array<Sense360Survey>) {
     
}

Access method

The Sense360 SDK has getPreviouslyDownloadedSurveys() public method that returns the last survey the SDK has downloaded, if any. These surveys may be displayed within the application interface (UI) to be consistent with the other survey displayed within the application.

The SDK only downloads one survey at a time, and only one is available on the device. Additionally, you can use the Survey download delegate to be automatically notified when a new survey is available.

Note: This is a passive check that does not initiate a new survey download.
private var surveys: [Sense360Survey] = [Sense360Survey]()

private func getPreviouslyDownloadedSurveys() {
    self.surveys = Sense360.getPreviouslyDownloadedSurveys()
    if surveys.count > 0 {
    // ...
    }

Survey object table

When downloading a survey, these fields are part of the survey object table:

Field nameData typeDescriptionExample
survey_urlStringThe URL for the available surveyhttps://surveys.give-feedback.co/survey?app_id=com.sense360.example&user_id=53161697-CC0E-4145-9DE4-04D715B603FD&p=1&audit_id=&survey_id=717133ad-e11d-47a6-b319-13049c0bdd72
survey_availableBooleanWhether this survey is still available at the time of downloading ittrue
project_idStringThe project ID associated with the survey"eae547ec-d93e-43ca-bf9c-553ebcee9ba1 -123"
survey_titleStringThe title for the available surveyQuick survey opportunity!
survey_descriptionStringThe description for the available surveyShort survey related to the brands you recently visited.
length_of_interviewIntegerThe number of minutes of the interview5
third_party_user_idStringThe third-party user ID provided by integrating application"0123456789"
survey_idStringThe Sense360 assigned unique survey ID"d0121724-bbd6-4ee2-8c15-64d48748ed82"