![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
pg-geolocation
Advanced tools
Get current location in android & ios mobile app
Installing the Cordova CLI
npm install -g cordova
Create the App
cordova create hello com.example.hello HelloWorld
cd hello
Add Platforms
cordova platform add ios
cordova platform add android
Add plugin
cordova plugin add pg-geolocation
cordova plugin add cordova-plugin-add-swift-support --save
onDeviceReady: function() {
app.receivedEvent('deviceready');
geolocation.getgeolocation(
'Geolocation',
function(msg) {
document.getElementById('lat').innerHTML = msg[0].lat;
document.getElementById('lng').innerHTML = msg[1].lng;
},
function(err) {
document.getElementById('lat').innerHTML = err;
}
);
geolocation.getstatus(
'Plugin Ready',
function(msg) {
document.getElementById('deviceready').querySelector('.received').innerHTML = msg;
},
function(err) {
document.getElementById('deviceready').innerHTML = '<p class="event received">' + err + '</p>';
}
);
geolocation.getname(
'Geolocation plugin',
function(msg) {
document.getElementsByTagName('h1')[0].innerHTML = msg;
},
function(err) {
document.getElementsByTagName('h1')[0].innerHTML = err;
}
);
},
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
<div class="">
<p>Latitude: <span id="lat"></span></p>
<p>Longitude: <span id="lng"></span></p>
</div>
</div>
Build app
cordova build ios
Run app in Xcode
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Build app
cordova build android
Run app on device
cordova run android
FAQs
Get current location in android & ios mobile app
We found that pg-geolocation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.