Show a survey manually
showSurvey shows one survey by its Survey ID. Use it when your code knows the moment better than a trigger could: a “Give feedback” button, the end of a support chat, a step in a flow.
The form needs the Mobile app channel switched on. It needs no triggers: a form without triggers is shown only by showSurvey. The Survey ID is on the form’s Share → Mobile app tab.
Show a survey
Section titled “Show a survey”Responsly.shared.showSurvey("AbCd1234")Responsly.showSurvey("AbCd1234", ShowOptions())Responsly.showSurvey('AbCd1234', {})Responsly.showSurvey('AbCd1234');ResponslySDK.ShowSurvey("AbCd1234", new ShowOptions());The call returns immediately. The survey loads in the background and appears when it is ready. The outcome arrives through callbacks: surveyShown, or surveyNotShown with a reason.
What is checked
Section titled “What is checked”showSurvey respects most of the rules set in the Mobile app tab.
| Rule | Applies to showSurvey | With force |
|---|---|---|
Tracking enabled (setTrackingEnabled) | yes | yes |
| Survey ID exists and the channel is on | yes | yes |
| No other survey visible or waiting | yes | yes |
| Schedule | yes | no |
| Audience: platforms, app IDs, languages, identified, conditions | yes | no |
| Frequency | yes | no |
| Display guard | yes | no |
pause | no | no |
| Pause between surveys | no | no |
| Share of users | no | no |
| Delay | no | no |
A survey shown with showSurvey still counts as a display for the frequency rules.
Options
Section titled “Options”All four options are optional.
| Option | Type | Effect |
|---|---|---|
force | boolean, default false | Skips schedule, audience, frequency and the display guard. |
hiddenFields | map of string to string | Hidden-field values for this survey only. |
locale | language tag | Language for this survey only. |
presentation | bottom_sheet, dialog or fullscreen | Overrides the style set in the Mobile app tab for this call. |
Responsly.shared.showSurvey("AbCd1234", options: ResponslyShowOptions( force: false, hiddenFields: ["order_id": "A-77"], locale: "pl", presentation: .dialog))Responsly.showSurvey("AbCd1234", ShowOptions( force = false, hiddenFields = mapOf("order_id" to "A-77"), locale = "pl", presentation = PresentationStyle.DIALOG,))Responsly.showSurvey('AbCd1234', { force: false, hiddenFields: { order_id: 'A-77' }, locale: 'pl', presentation: 'dialog',})Responsly.showSurvey( 'AbCd1234', force: false, hiddenFields: {'order_id': 'A-77'}, locale: 'pl', presentation: ResponslyPresentation.dialog,);ResponslySDK.ShowSurvey("AbCd1234", new ShowOptions{ Force = false, HiddenFields = new Dictionary<string, string> { { "run_id", "42" } }, Locale = "pl", Presentation = ResponslyPresentation.Dialog,});force shows the survey regardless of audience, schedule and frequency, and without asking the display guard. Three things still stop it:
- tracking is disabled (
disabled), - the Survey ID is unknown or the channel is off (
survey_not_found), - another survey is visible or waiting (
another_survey_visible).
Use it for user-initiated surveys that must always open, and while testing.
Responsly.shared.showSurvey("AbCd1234", options: ResponslyShowOptions(force: true))Responsly.showSurvey("AbCd1234", ShowOptions(force = true))Responsly.showSurvey('AbCd1234', { force: true })Responsly.showSurvey('AbCd1234', force: true);ResponslySDK.ShowSurvey("AbCd1234", new ShowOptions { Force = true });hiddenFields
Section titled “hiddenFields”Values that belong to this one survey: an order number, a ticket ID, the screen the button was on. They are combined with the values from setHiddenFields; for a name present in both, the per-call value is used. See Hidden fields.
locale
Section titled “locale”Shows this survey in the given language, whatever the device language or setLocale say. See Language.
presentation
Section titled “presentation”Overrides the container style (bottom sheet, dialog, full screen) for this call. Size, auto-close and the close button still come from the Mobile app tab. See Appearance.
When nothing appears
Section titled “When nothing appears”showSurvey does not report failure to the caller. If the survey is not shown, listeners get surveyNotShown with the reason, and the debug log has a line for it. Reasons specific to showSurvey:
| Reason | Cause |
|---|---|
not_initialized | showSurvey was called before initialize. Unlike other calls, it is not remembered for later. |
config_unavailable | The configuration could not be downloaded and there is no cached copy. Check the SDK key and the connection. |
survey_not_found | The Survey ID is not in the configuration: wrong ID, channel off, or a change made in the last 10 minutes that this device has not downloaded yet. |
load_failed | The survey did not load within 15 seconds. The device is probably offline. |
Every reason is listed in Testing & debugging.
Close it from code
Section titled “Close it from code”closeSurvey closes the survey that is visible or about to appear. See Control when surveys appear.