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.
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 name | Data type | Description | Example |
---|---|---|---|
survey_url | String | The URL for the available survey | https://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_available | Boolean | Whether this survey is still available at the time of downloading it | true |
project_id | String | The project ID associated with the survey | "eae547ec-d93e-43ca-bf9c-553ebcee9ba1 -123" |
survey_title | String | The title for the available survey | Quick survey opportunity! |
survey_description | String | The description for the available survey | Short survey related to the brands you recently visited. |
length_of_interview | Integer | The number of minutes of the interview | 5 |
third_party_user_id | String | The third-party user ID provided by integrating application | "0123456789" |
survey_id | String | The Sense360 assigned unique survey ID | "d0121724-bbd6-4ee2-8c15-64d48748ed82" |