You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I went through your repositry and installed the plugin via cli as shown below
every thing went well and then i pasted your code in my index.html in <script> tags but after initialization nothing happens below is my code:
<script type="text/javascript">
app.initialize();
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
//Make sure to get at least one GPS coordinate in the foreground before starting background services
navigator.geolocation.getCurrentPosition(function () {
/// alert(59);
console.log("Succesfully retreived our GPS position, we can now start our background tracker.");
}, function (error) {
console.error(error);
});
}
//Get plugin
var bgLocationServices = window.plugins.backgroundLocationServices;
alert(70);
//Congfigure Plugin
bgLocationServices.configure({
//Both
desiredAccuracy: 20, // Desired Accuracy of the location updates (lower means more accurate but more battery consumption)
distanceFilter: 0.01, // (Meters) How far you must move from the last point to trigger a location update
debug: true, // <-- Enable to show visual indications when you receive a background location update
interval: 1000, // (Milliseconds) Requested Interval in between location updates.
useActivityDetection: true, // Uses Activitiy detection to shut off gps when you are still (Greatly enhances Battery Life)
//Android Only
notificationTitle: 'BG Plugin', // customize the title of the notification
notificationText: 'Tracking', //customize the text of the notification
fastestInterval: 1000 // <-- (Milliseconds) Fastest interval your app / server can handle updates
});
alert(86);
//Register a callback for location updates, this is where location objects will be sent in the background
bgLocationServices.registerForLocationUpdates(function (location) {
console.log("We got an BG Update" + JSON.stringify(location));
}, function (err) {
console.log("Error: Didnt get an update", err);
});
alert(93);
//Register for Activity Updates
//Uses the Detected Activies / CoreMotion API to send back an array of activities and their confidence levels
//See here for more information:
//https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity
bgLocationServices.registerForActivityUpdates(function (activities) {
console.log("We got an activity update" + activities);
}, function (err) {
console.log("Error: Something went wrong", err);
});
alert(104);
// //On the first location success? Ie:
// navigator.geolocation.getCurrentPosition(function() {
// //omitting initialization parameters...
// alert(113);
// bgLocationServices.start();
// }, function(error) {
// alert(116);
// console.error(error);
// });
alert(115);
//Start the Background Tracker. When you enter the background tracking will start, and stop when you enter the foreground.
bgLocationServices.start();
alert(108);
///later, to stop
// bgLocationServices.stop();
</script>
So can you guide me where am i lacking? or it is not properly installed? although it is showing its inclusion in cordova_plugins.js too and folders are as well in appropriate places.
Regards,
Ahsan
The text was updated successfully, but these errors were encountered:
Hi Paul!
I went through your repositry and installed the plugin via cli as shown below
every thing went well and then i pasted your code in my index.html in <script> tags but after initialization nothing happens below is my code:
So can you guide me where am i lacking? or it is not properly installed? although it is showing its inclusion in cordova_plugins.js too and folders are as well in appropriate places.
Regards,
Ahsan
The text was updated successfully, but these errors were encountered: