App to only work around certain location

Im wondering if it is possible to make apps, or atleast certain actions only work in a certain location? like a 1km radial (eg, around Work only)

Sure can, check out DISTANCE() and other related results:
https://help.appsheet.com/en/?q=distance

So you could do something like this:

DISTANCE([HERE(), [LatLong_Column]) <= 1

2 Likes

Its worth noting that any devices latlong can be spoofed via third party applications on the device itself or even when running it in chrome with chrome dev tools.

2 Likes

Thanks for the tip. This will circumvent 95% of the problems, but good to keep in mind for those tech savvy people out there :slight_smile:

2 Likes

Should this work?

DISTANCE(HERE(), “13.993581”, “-40.555116”) <= 1

I don’t want to have to make a column for this, just hardcode it.

Its saying I have invalid inputs,

Nope. DISTANCE() takes two arguments, not three. Both arguments must be of type LatLong. The LATLONG() function may be used to construct a LatLong value from individual latitude and longitude values:

DISTANCE(HERE(), LATLONG(13.993581, -40.555116))

See also:

3 Likes

Ok,

So using this to either show or not show an action

if(Context("Host")<>Browser,
IF(USEREMAIL() = "an email", "true", 
IF(USEREMAIL() = "an email","true",
DISTANCE(HERE(), LatLong("41.945583", "-43.812112")) <= 1)),"true")

Its saying its needs something that either returns true of false,

Is the above expression not doing just that?

There are 2 users who need to be able to use the app wherever, also assuming this does ant work with browsers

If you’ve got more than one of anything, consider using a list instead. You could try:

and(
Context(“Host”) <> “Browser”,
if(in(USEREMAIL(), LIST(“Email1”, “Email2”)),
true,
DISTANCE(HERE(), LatLong(“41.945583”, “-43.812112”)) <= 1)
)

1 Like

Strange,

IDK why its working now?? I would like to know.

I did change the and to or so the formula is exactly the same just a list instead?

or(
Context(“Host”) <> “Browser”,
if(in(USEREMAIL(), LIST(“Email1”, “Email2”)),
true,
DISTANCE(HERE(), LatLong(“41.945583”, “-43.812112”)) <= 1)
)

The major difference between OR and AND in this instance is the following:

  • When you use OR, as long as someone is not using a browser then everything will show. Because OR means that any of the conditions listed may be true in order for the whole thing to return TRUE - but it only needs to be one.
  • When you use AND, every statement must be true in order for the whole thing to return true.

When I said:

AND(
Context(“Host”) <> “Browser”,
  if(....

I’m saying, the host cannot be a browser AND whatever the IF says.
The if part:

...if(in(USEREMAIL(), LIST(“Email1”, “Email2”)),
true,
DISTANCE(HERE(), LatLong(“41.945583”, “-43.812112”)) <= 1)
)

Here I’m saying:

  • if the USEREMAIL is part of the list (which you could totally make a table/slice list instead ( Admin_User_Slice[Email] ) - or even an EnumList or related records) then always give TRUE as a result (because we want them to always see this button); otherwise
  • do the whole geofencing thing. :wink: