Open Nerconer opened 4 months ago
Thanks for raising your issue. Team will check this at our end and will update you accordingly.
@Nerconer - It seems there might be a misunderstanding regarding the navigator.permissions.query({ name: "geolocation" }) method. This method is a standard web API for checking the permission status of a given permission name, such as "geolocation". However, in the context of the Microsoft TeamsJS library, as of version 2.1.0, you should use the following functions for geolocation purposes:
geoLocation.getCurrentLocation(): Promise
These API is in Beta and provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
If you are looking for the navigator.permissions.query({ name: "geolocation" }) method within the TeamsJS library documentation, it might not be listed as it is not a part of the TeamsJS library but a standard web API. For geolocation functionalities within Teams applications, you should use the TeamsJS library's geolocation APIs as mentioned above.
If you have any further query, feel free to ask!
Hello @Nivedipa-MSFT,
Thanks for your reply. I will check that API and update you.
One question that still is not clear for me. What API should be used in production environment then?
Thanks!
The following code produces the next output using New Teams client.
console.log(`Teams SDK version: ${microsoftTeams.version}`)
console.log(`Is GeoLocation supported: ${microsoftTeams.geoLocation.isSupported()}`)
// Classic Teams client
if (microsoftTeams.geoLocation.isSupported()) {
console.log("Getting location using microsoftTeams");
microsoftTeams.geoLocation.map.chooseLocation().then((result) => {
document.getElementById("text").innerHTML = "Your location has been shared.";
microsoftTeams.tasks.submitTask(result);
}).catch((error) => {
displayErrorScreen()
});
} else {
// Teams V2 client
console.log("Getting location using navigator");
getLocationUsingNavigator();
}
As you can see, microsoftTeams.geoLocation.isSupported()
returns false
.
Using Classic Teams, returns true
.
@Nerconer - We are checking this with engineering team, we will inform you once we get any updates from them.
Hi @Nivedipa-MSFT - Thanks for the reply. Do you have any updates?
@Nerconer - The teams-js geolocation APIs aren't supported in the New Teams Client. Ref Doc: https://learn.microsoft.com/en-us/microsoftteams/platform/resources/teams-updates#limitations
You can use the standard HTML5 Geolocation API whenever the geoLocation.isSupported API returns false: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API
Please share if you have any further query here?
@Nivedipa-MSFT - As mentioned at the beginning, we are already using HTML Geolocation in New Teams and because it's a broken functionality at this time (most of the times doesn't work), my original request was if it was possible to add support using teams-js library again since when we were using it in Classic, we never had any issues.
Please, let me know what can we do.
Thanks!
@Nerconer - We received a response from the engineering team indicating that there are no immediate plans to implement support for the geoLocation APIs in the New Teams Client. Although the task is recorded in our backlog, it is not a priority at the moment.
Please update as to when this will be available in Production. It's a critical feature and having something that's unreliable is worse really than having nothing at all. Thanks, Duncan
Hello,
With new Teams client, it is expected to use
navigator.permissions.query({ name: "geolocation" })
method to retrieve user location instead ofmicrosoftTeams.location.getLocation(locationProps, (err, location)
as we could using Classic Teams client.Example:
https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/app-checkin-location/nodejs/views/CheckIn.ejs
This new alternative has been proven for us to not be reliable since most of the times, we don't get any response even when
result.state
is equal togranted
. It behaves different across browsers, mobile devices and the desktop client.It seems for us that
navigator.permissions.query({ name: "geolocation" })
has been getting worse over time.We didn't had any issues in the past using the Classic Teams method and now it feels that this feature is broken. For some users works and for others don't (at the same time). However, most of the time, it doesn't.
It would be great if you could add support again to this feature.
Thanks in advance