Select to view content in your preferred language

Is it possible to get device location without Internet access? If yes, then how ?

326
4
09-06-2024 04:12 AM
Ashok
by
Occasional Contributor

Dear Community,

I have a requirement that, I would like to get device location and store it in assignments layer (in some test field) on submitting the assignments. And I need this in offline (without Internet access).

Please note, not the feature location, I need device location when I submit/complete the assignment.

Please let me share some ideas or process , how to get it done.

 

Thanks,

Ashok

 

0 Kudos
4 Replies
Y_Chau
by
Frequent Contributor

@Ashok This could be what you are looking for - https://doc.arcgis.com/en/field-maps/android/use-maps/track.htm

0 Kudos
DougBrowning
MVP Esteemed Contributor

Is it Android or iOS?  Most Samsung tablets have a GPS in them so they will work fine.  iPads have a dual chip GPS and cell so in order to have GPS chip it must be a cellular tablet.  You don't have to enable cell just must have the chip.  A WiFi only iPad does NOT have a GPS chip.  This could be what you are seeing. Need more info.

0 Kudos
Ashok
by
Occasional Contributor

Dear @DougBrowning , Thanks for your reply. I am using iPad WiFi only tab. 

But I was asked to switch on the location when I opened my project in Field Maps app. And I can also see location option in app settings -> Field maps settings.

Please check the below pictures for reference.

Image (2).pngImage (1).png

 

 

 

 

 

 

 

 

 

 

 

 

And I observed, in offline new tracks records are inserting in Tracks layer of TrackView that we created and configured in Track Viewer portal app.

But here my only concern was, I wanted to get the User/Device location when he submits the assignment or when he opened the assignment to fill the survey form in Field maps app. In online(when Internet is available), I got succeed. In order to achieve that I have added "Last Known Locations" layer (of TrackView) in my Field Map Project. And I am able to get the latest user/device location by using the following Arcade expression, and I am using this expression for one of the Field's Calculate expression and displaying the Result.

//Start

function MetersToLatLon(x, y) {
    var long = (x / 20037508.34) * 180;
    var lat = (y / 20037508.34) * 180;
    lat = 180.0 / PI * (2.0 * Atan( Exp( lat * PI / 180.0)) - PI / 2.0);
    return{
        y: lat,
        x: long
    }
}

var serverlayer = FeatureSetByName($map, "Location Sharing - Last Known Locations")
var loggedinuser = GetUser($layer).username;
var lastediteduser = null;
var userGeometry = null;

for(var user in serverlayer){
  if(user.last_edited_user == loggedinuser){
     lastediteduser = user.last_edited_user
     userGeometry = Geometry(user);
    break;
  }
}
var latlon = MetersToLatLon(userGeometry.X, userGeometry.Y);
return Round(latlon.x,6)+","+Round(latlon.y,6);
 

//End

In order to achieve same thing in offline, map should be offline enabled, so that map can be downloaded in FieldMap app for offline use.  But I am getting an error that "The feature layer view is created from a layer that isn't sync-enabled".

image.png

I understood that the feature layer "Last Known Locations" Sync option is disabled. This layer is created as Feature Layer (hosted, view) and actually created by system when we create a project from Track Viewer app. And there is no provision to make Sync enable for this layer in Portal item settings and in ArcGIS server settings. 

I think, if I can resolve the above error, I may get succeed in offline map also

Please suggest how to resolve this issue or any other process. 

Thanks,

Ashok

0 Kudos
DougBrowning
MVP Esteemed Contributor

Yes the iPad will try and guess your location from WiFi and often it was use the last location it had - but it for sure has no GPS chip.  

0 Kudos