How to capture Lat, Long in PWA?

How to capture Lat, Long in PWA?

5 Likes

The location details of the device can be captured from the below-mentioned service and sample code. I am also sharing the link for the usage of the package and its functionalities for more clarity.
The same is available through the ng-vahana-utils library
ng-vahana-utils library
This is an Angular-based library that provides the basic functionalities listed below required in most of the web applications based on the Vahana Platform.
Service Name: DeviceDetailsService
DeviceDetailsService provides the information of the browser on which the application is running. Below functions are provided by the service. Import the below service in the required component using the below code:

import { DeviceDetailsService, LoggerService } from "ng-vahana-utils";

export class AppComponent{

constructor(
private deviceDetails: DeviceDetailsService,
private logger: LoggerService
){}

}

Sample Code.
this.deviceDetails.getDeviceLocation().then(
(res) => {
this.logger.log(“location details”, res);
},
(error) => {
this.logger.log(“error from getDeviceLoaction function”, error);
}
);

7 Likes