How to automatically sign in and download surveys using Survery123 in AppStudio?

2665
2
06-10-2016 09:19 AM
IanDunn1
New Contributor

We're putting together a Survey123 App using AppStudio and currently when the app opens, the user still has to sign in before they can submit any surveys.  Also, the first time the user logs in, they have to manually download the survey.

I was wondering if A) there is a place in the qml code to embed a username and password and have the app automatically sign into ArcGIS Online when opened and B) if the was a way to automatically download a survey when the user logs in?

Thanks in advance

Ian

0 Kudos
2 Replies
SathyaPrasad
Esri Contributor

A) there is a place in the qml code to embed a username and password and have the app automatically sign into ArcGIS Online when opened

Technically yes its possible. According to the portal license agreement please be aware that you cannot embed named-user credentials in your app inside of your code (i.e. you cannot write an app using one named user account embedded and multiple people use the same app without logging in). You will have to ask each user to log in and then you can persist the credentials until the user logs out.

B) if the was a way to automatically download a survey when the user logs in?

Not part of the product, requires customization but its very do-able. If you see how a survey is being downloaded now you will get an idea (DownloadSurveysPage.qml)

IanDunn1
New Contributor

Thanks for the reply Sathya. 

So I think I'm close to getting the survey to auto download.  If I'm understanding this correctly, after the user signs in the app automatically searches for surveys and then the user can download them.  So I took the download function from further down the page and placed it after the search function.  My thought was that once the search results are returned, I could just have the download function download them.  However I can't figure out a way to reference the specific survey to download.  My idea was to try and pass the survey idea to the download function but I'm not quite sure how to do that.  Any help would be much appreciated.

As far as the logins go I was under the impression from speaking with others at ESRI that this sort of functionality was ok using AppStudio and in fact the whole reason we started developing with AppStudio was so that we could have anonymous users submit surveys.  If this isn't the case are there any plans in the works for anonymous data collection using AppStudio and Survey123?  I think this would be an incredibly useful improvement and would great increase the use cases for Survey123.

Thanks,

Ian

0 Kudos