diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js
index 4dcc25e5dd..a5816da5b9 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.js
@@ -17,7 +17,7 @@
*/
function onRequest(context) {
- // var log = new Log("device-view.js");
+// var log = new Log("device-view.js");
var deviceType = context["uriParams"]["deviceType"];
var deviceId = request.getParameter("id");
var deviceViewData = {};
@@ -32,7 +32,7 @@ function onRequest(context) {
var filteredDeviceData = response["content"];
- // creating deviceView information model from filtered device data
+// creating deviceView information model from filtered device data
var viewModel = {};
if (filteredDeviceData["type"]) {
viewModel["type"] = filteredDeviceData["type"];
@@ -194,7 +194,7 @@ function onRequest(context) {
if (!filteredDeviceData["initialDeviceInfo"] && !filteredDeviceData["latestDeviceInfo"]) {
viewModel["deviceInfoAvailable"] = false;
}
-
+ viewModel.locationHistory = stringify(filteredDeviceData["locationHistory"]);
deviceViewData["device"] = viewModel;
} else if (response["status"] == "unauthorized") {
deviceViewData["deviceFound"] = true;
diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js
index c09ab8ddb7..c9daa3f440 100644
--- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js
+++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/public/js/load-map.js
@@ -22,15 +22,27 @@ function loadLeafletMap() {
var deviceLocationID = "#device-location",
lat = $(deviceLocationID).data("lat"),
long = $(deviceLocationID).data("long"),
+ locations = $(deviceLocationID).data("locations"),
container = "device-location",
zoomLevel = 13,
tileSet = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
attribution = "©
OpenStreetMap contributors";
- if (lat && long) {
+ if (locations) {
+
+ var locationSets = locations.locations;
map = L.map(container).setView([lat, long], zoomLevel);
L.tileLayer(tileSet, {attribution: attribution}).addTo(map);
- L.marker([lat, long]).addTo(map).bindPopup("Device is here...").openPopup();
+
+ for(var i = 0; i < locationSets.length; i++){
+ var m = L.marker(locationSets[i]).addTo(map).bindPopup(new Date(locations.times[i].time).toISOString())
+ m.on('mouseover', function (e) {
+ this.openPopup();
+ });
+ m.on('mouseout', function (e) {
+ this.closePopup();
+ });
+ }
$("#map-error").hide();
$("#device-location").show();