cancel
Showing results for 
Search instead for 
Did you mean: 

Access device location in Agentry

Former Member
0 Kudos

Hi,

Does anyone know if I can access the device location in an Agentry application?

The permissions for the Android Work Manager list GPS/Network location so I guess it might be possible?

Could I enhance one of the objects to include the location and pass it back to SAP?

Thanks,

Gregor

Tags edited by: Michael Appleby

Accepted Solutions (1)

Accepted Solutions (1)

jason_latko
Active Contributor
0 Kudos

Gregor,

Yes.  Do it in a two step transaction process.  First add 3 properties to the main object: Location (type location), Latitude (Decimal) and Longitude (Decimal).

Run a transaction called ResetGPS:  One property is Location.  This points to the location object in the Main object.  Use initial value of rule before data entry.  Add a rule called ResetLocationGPS.  It looks like this:

GPS_LOCATION

     0

Above rule uses the GPS_LOCATION System rule function to force the GPS to query the current position.

Apply the above transaction.

Run a second transaction called QueryGPS.  Two properties here.  Latitude points to the latitude main object property, and also longitude points to longitude main object property.  Both properties use rule after data entry.  The latitude rule looks like this.  Do something similar for the longitude:

The BestEntry.GPSPrecision is a global and is set to 8.  This limits the length of the returned value after the decimal point so it isn't so large.  If you don't care about limiting the value, you can just take the FROM_DECIMAL_VALUE of the Current Latitude and forget the rest.

Apply this transaction.

Now the current lat and long are stored in the main object properties and can be used however you like.  This worked for me on an iPhone, but should work exactly the same on any GPS enabled device.

Jason Latko - Senior Product Developer at SAP

Former Member
0 Kudos

Thanks for the detailed reply Jason. I will give it a try.

Former Member
0 Kudos

Hi Jason,

This seems to be working fine for me in ATE when using the GPS simulation but not on the actual mobile device (Windows 8.1).

Anything else i should be looking out for?

Thanks.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

What client and version are you using on the device?  The initial WPF client did not support the location field type but this was added in SMP 3 SDK05.

If you are using an earlier client you will need to upgrade.

For SMP 2.3 it will be in the next SP

--Bill

Former Member
0 Kudos

Hi Bill,

Agentry Client: v70.5.1.10

Am also using SMP3 SP Level 3 SDK SP05.

Thanks.

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

It should work then.  If you are still having issues I suggest opening a new thread as this one is already marked answered.

--Bill

Answers (0)