Collect device location while offline and without a map?

692
6
11-02-2017 09:39 AM
NathanKota
New Contributor II

We're hoping to use the Quick Report template to build a simple app, but we do not want to show a map and, instead, need to collect the device location at the time the observation is saved. Many app users will be outside of a cellular network when collecting data. The app will use a feature service on our enterprise server to store data . Can the Quick Report template be configured to store the device's location without using a map? If so, how?

0 Kudos
6 Replies
nakulmanocha
Esri Regular Contributor

Quick Report template uses the device as the position source to get the location when there is no network available. So if you have no network. You map won't load but you can go ahead and save the report using the location saved at the time the report was collected. Once you have the network you can go ahead and submit that report and the feature will be added using the location it used to save the report. This is all done as default. No further configuration needed.

Nakul

0 Kudos
NathanKota
New Contributor II

Thank you for the explanation Nakul. Since the application will collect the device location even without the map, is it possible to set the application so that the map never appears? 

0 Kudos
nakulmanocha
Esri Regular Contributor

This type of setting is not configurable. So you need to dig into the code to make it happen. Precisely you can go to the RefineLocationPage.qml and comment out the initUrl of the Map component and then the Map will never load. Also in the same page you need to comment out the onClicked signal handler for the refresh button

  NewControls.Label{
                anchors.top: refreshButton.bottom
                anchors.topMargin: 8*app.scaleFactor
                anchors.horizontalCenter: parent.horizontalCenter
                horizontalAlignment: Text.AlignHCenter
                color: "#565656"
                maximumLineCount: 2
                font.pixelSize: app.subtitleFontSize
                font.family: app.customTextFont.name
                wrapMode: Text.Wrap
                text: qsTr("Map is not available offline.\nClick to refresh.")
                width: Math.min(280*app.scaleFactor, parent.width*0.6)
                visible: refreshButton.visible
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        //var webMapUrl = app.webMapRootUrl + app.webMapID;
                       // var newMap = ArcGISRuntimeEnvironment.createObject("Map", {initUrl: webMapUrl});
                        //mapView.map = newMap;
                    }
                }
            }

There is another way out in which you can force user not to change the location of the map. If there is network it will use network location but user cannot pan or change the location and when there is no network it will use device location. This can also be done. See my other thread reply

https://community.esri.com/thread/202672-prevent-refine-location 

nakulmanocha
Esri Regular Contributor

I almost forgot to mention this is only possible with point feature layers.

0 Kudos
NathanKota
New Contributor II

Thank you again Nakul. I will start building the application and consider all of the information you have provided. 

0 Kudos
NathanKota
New Contributor II

I followed your instructions Nakul and, indeed, the map does not load. Where may I change the code so that the Add Location page is skipped, since we do not want the user to use the map at all, and only want to collect and store the device location? 

0 Kudos