App to only work around certain location

Jonathan_S
Participant V

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)

Solved Solved
1 9 572
1 ACCEPTED SOLUTION

MultiTech
Participant V

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

View solution in original post

9 REPLIES 9

MultiTech
Participant V

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

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.

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

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:

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)
)

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.
Top Labels in this Space