The functionality of the web application is not supported in Multi-Device-Hybrid-Apps format

I am encountering an issue with my app that functions perfectly as a typical web app, but fails to work properly when converted into a Multi-Device-Hybrid-App format. The problematic sections are indicated in a screenshot of the app. Below is my complete code:
JS:

var app = angular.module('app', []);
app.controller('firstCtrl', function($scope, $timeout) {
  var myLat, myLon, locLat, locLon;
  navigator.geolocation.watchPosition(GetLocation);

  $scope.ASiteLocs = [{
    "name": "IL5077 BRUSSELS",
    "styleUrl": "#waypoint",
    "Point": {
      "coordinates": "-90.58543899999999,38.955472,0"
    }
  }, {
    "name": "IL5076 KAMPSVILLE",
    "styleUrl": "#waypoint",
    "Point": {
      "coordinates": "-90.661923,39.29403,0"
    }
  }, {
    "name": "IL5146 CARROLLTON",
    "styleUrl": "#waypoint",
    "Point": {
      "coordinates": "-90.39965700000001,39.309142,0"
    }
  }];
  $scope.SSiteLocs = [{
    "name": "502 Nelson St, Greenville, MS 38701",
    "visibility": "0",
    "description": "502 Nelson St, Greenville, MS 38701",
    "styleUrl": "#waypoint",
    "Point": {
      "coordinates": "-91.05636,33.415485,0"
    }
  }, {
    "name": "242 Blackhawk Trace, Galena, IL 61036",
    "visibility": "0",
    "description": "242 Blackhawk Trace, Galena, IL 61036",
    "styleUrl": "#waypoint",
    "Point": {
      "coordinates": "-90.319778,42.390862,0"
    }
  }, {
    "name": "3747 Ocean Dr, Vero Beach, FL 32963",
    "visibility": "0",
    "description": "3747 Ocean Dr, Vero Beach, FL 32963",
    "styleUrl": "#waypoint",
    "Point": {
      "coordinates": "-80.358248,27.659094,0"
    }
  }];
  $scope.SiteLocs = $scope.SSiteLocs.concat($scope.ASiteLocs);
  $scope.repoSortOrder = "+name";


  function GetLocation(location, myLat, myLon) {
    myLat = location.coords.latitude;
    myLon = location.coords.longitude;
    document.getElementById("lat").innerHTML = myLat;
    document.getElementById("lon").innerHTML = myLon;
    $timeout(function() {
      calculate();
    });

  }

  $scope.getCoordDistance = function(myLat, myLon, locLat, locLon) {
    console.log(myLat.toString(), myLon);
    var lat1 = locLat; //41.887055
    var lon1 = locLon; //-88.469233
    var lat2 = myLat; //41.888668
    var lon2 = myLon; //-87.640371

    var R = 3959;
    var x1 = lat2 - lat1;
    var dLat = x1 * Math.PI / 180;
    var x2 = lon2 - lon1;
    var dLon = x2 * Math.PI / 180;
    a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
      Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *
      Math.sin(dLon / 2) * Math.sin(dLon / 2);
    c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    var d = R * c;
    return d;

  };


  angular.forEach($scope.SSiteLocs, function(object) {
    object.carrier = 'Sprint';
  });
  angular.forEach($scope.ASiteLocs, function(object) {
    object.carrier = 'AT&T';
  });

  var calculate = function() {
    angular.forEach($scope.SiteLocs, function(location) {
      var clength = location.Point.coordinates.length;
      if (location.Point.coordinates.substring(clength - 2, clength) === ",0") {
        location.Point.coordinates = location.Point.coordinates.substring(0, clength - 2).split(",");
        Lat = location.Point.coordinates[0];
        Lon = location.Point.coordinates[1];
        Com = ",";
        location.Point.coordinates = Lon.concat(Com, Lat);
        myLat = Number(document.getElementById("lat").innerHTML);
        myLon = Number(document.getElementById("lon").innerHTML);

        locLat = Lon;
        locLon = Lat;
        d = $scope.getCoordDistance(myLat, myLon, locLat, locLon);
        d = d.toFixed(1);
        d = Number(d);
        location.distance = d;
      }

    });
  };
});

HTML:

<!DOCTYPE html>
<html ng-app="app">
<head>
    <link href="http://fonts.googleapis.com/css?family=Droid+Serif" rel="stylesheet" type="text/css" />
    <script data-require="angular.js@*" data-semver="1.2.17" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js"></script>
    <script data-require="jquery@*" data-semver="2.1.1" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script data-require="<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="82e5edede5eee7afefe3f2f1c2b3acb2acb2">[email protected]</a>" data-semver="1.0.0" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    <script data-require="angular-route@*" data-semver="1.2.17" src="http://code.angularjs.org/1.2.17/angular-route.js"></script>
    <script data-require="geo-location-javascript@*" data-semver="0.4.8" src="//cdnjs.cloudflare.com/ajax/libs/geo-location-javascript/0.4.8/geo.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
    <script src="cordova.js"></script>
    <script src="scripts/platformOverrides.js"></script>
    <link href="css/index.css" rel="stylesheet" />
    <script src="scripts/script.js"></script>
    <title>ECC</title>
</head>
<body link="white" vlink="white">
    <center>
        <h1>Site Lookup</h1>
        <div>{{site.carrier}}</div>
        <div ng-controller="firstCtrl">
            <input type="text" ng-model="search" border="1" placeholder="Search Name or Distance" />
            <br><div id="astDiv">Select sort option...</div>
            <select ng-model="repoSortOrder">
                Sort by
                <option value="+name">Name--Alphabetical</option>
                <option value="-name">Name--Backwards Alphabetical</option>
                <option value="-distance">Distance--Descending</option>
                <option value="+distance">Distance--Ascending</option>
            </select>
            <div id="astDiv">*Distances are not exact*</div>
            <table border="1">
                <thead>
                    <tr>
                        <td>Name</td>
                        <td>Distance*</td>
                        <td>Carrier</td>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="site in SiteLocs | orderBy:repoSortOrder | filter : search">
                        <td>
                            <a ng-href="http://maps.google.com/?q={{site.Point.coordinates}}">
                                {{site.name}}
                            </a>
                        </td>
                        <td>{{site.distance}} Miles</td>
                        <td>
                            {{site.carrier}}
                        </td>
                    </tr>
                </tbody>
            </table>
            <div id="lat"></div>
            <div id="lon"></div>
        </div>
    </center>
</body>
</html>

CSS:

@font-face {
    font-family: myFirstFont;
    src: url(roboto-light.ttf);
}

html{

  background: url(http://www.pixeden.com/media/k2/galleries/220/006-wood-melamine-subttle-pattern-background-pat.jpg)

}
a {
    text-decoration: none;
}
table{
    color: white;
    font-size:1.25em;
    font-family: 'Droid Serif', serif;
    text-align: left;
    vertical-align: middle;
    width: 100%;
}

input {
    border: 0px solid white; 
    -webkit-box-shadow: 
      inset 0 0 40px  rgba(20,20,20,500),
            0 0 40px rgba(20,20,20,500); 
    -moz-box-shadow: 
      inset 0 0 40px  rgba(20,20,20,500),
            0 0 40px rgba(20,20,20,500); 
    box-shadow: 
      inset 0 0 5px  rgba(0,0,0,10),
            0 0 75px rgba(0,0,0,10); 
    padding: 15px;
    background: rgba(255,255,220,5);
    margin: 0 0 10px 0;
  -webkit-border-radius: 10px;
  -moz-border-radius: 10px;
  border-radius: 25px;
  font-family: 'Droid Serif', serif;

}
#astDiv{ color: white;}

h1 {
    color:#ffffff;
    font-family: 'Droid Serif', serif;
}

#latDiv {
    color:#000000;
    font-family: 'Droid Serif', serif;
}
#lonDiv {
    color:#000000;
    font-family: 'Droid Serif', serif;
}

The appearance of the app should be as depicted above: However, when viewed within a Multi-Device-Hybrid-App environment, it looks different: Additionally, clicking on a location name triggers a Google Maps search for the coordinates and opens a map based on them. Manipulation of the map's coordinates is performed in the code to ensure correct formatting. This functionality seems to fail in Multi-Device-Hybrid-Apps. I suspect the issue lies within the calculate() function, but I'm uncertain. Could there be platform-specific requirements or errors in my implementation? Any assistance would be greatly valued!!

Answer №1

In order to accurately determine the distance in miles, it is important for Chrome to have access to your computer's location. Once I granted permission for Ripple to use my computer's location, I was able to successfully calculate the distance in miles.

This application is currently operating on Ripple

If you want to learn how to display a specific location on Google Maps with a click event in a Cordova app, check out this Stack Overflow post: How to use Google Maps in Cordova app

For further guidance on loading Google Maps in a Cordova app, refer to this blog post: Loading Google Maps in Cordova the Right Way

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combining SlateJS with Redux

I need to store the value of a SlateJS editor in redux instead of state, but when I modify the hasLinks method, I encounter an immediate crash with the error message: TypeError: Cannot read property 'inlines' of undefined Modified Editor&apos ...

Capture all URL paths that accept query parameters

Is it achievable using ui-router to capture a pathway that includes forward slashes and query parameters? Consider having the catch-all rule in the state configuration: var exState = { url: '/example/*path', ... }; $stateProvider.state( ...

Pan motion gesture above HTML components

Is it possible to create a hovering effect over elements in a container using a pan gesture? Here's the HTML code: <div class="container"> <div class="item"></div> <div class="item"></div> <div class="item">< ...

Launching a bootstrap modal within another modal

I am facing a minor issue with two modal popups on my website. The first modal is for the sign-in form and the second one is for the forgot password form. Whenever someone clicks on the "forgot password" option, the current modal closes and the forgot pas ...

Creating input fields dynamically within Yii2 framework

I'm currently facing a challenge with forms in Yii2. My objective is to design a form that includes three dropdown menus, inquiring about the user's preferred time(s) during the week. The first menu will focus on selecting days of the week, while ...

"Step-by-step guide on showcasing a specific blog post using its unique identifier in an Angular/Express/MongoDB application

I'm struggling to figure out how to retrieve a single blog post by its ID, especially since I am new to this. Currently, my main blog application has an ng-repeat functionality that fetches all posts. What I really want is the ability to click on a p ...

What's the scoop on NodeJS, Express, Nginx, and Jade?

Currently exploring options for technologies and libraries to use in a new, large-scale project. With knowledge of NodeJS, JavaScript, Express, and Jade (now Pug), my team and I are leaning towards adopting these for the project. The main issue we're ...

What is the best way to send a JSON object to bootstrap-table?

In my controller, I am passing a JSON encoded object to the view. Using a Bootstrap table in the view to display the data, but it is showing "No matching records found." Can someone please assist with this issue? Here is my controller: see image And here ...

Slerping with quaternions in Three.js can produce undesirable outcomes when near the poles

Check out this video example: https://drive.google.com/file/d/18Ep4i1JMs7QvW9m-3U4oyQ4sM0CfIFzP/view In the demonstration, I showcase how I determine the world position of a ray hitting a globe under the mouse cursor. By utilizing lookAt() with a THREE.Gr ...

`switch tabs visibility based on checkbox selection`

There are 4 tabs available on a JSP page: Tab 1, Tab2, Tab3, and Tab4. Initially, only Tab1 is enabled, allowing users to freely work within that tab. However, Tabs 2, 3, and 4 are disabled, preventing users from accessing their contents. A checkbox is lo ...

Error: Trying to access the length property of an undefined or null reference in JSON formatted data fetched through Ajax

I am attempting to populate a jQuery DataTables with JSON data retrieved from a Web API ajax call, but encountering the following error: An unhandled exception occurred at line 38, column 314 in 0x800a138f - JavaScript runtime error: Unable to get proper ...

The link containing special characters like % cannot access the api

I am facing an issue with retrieving a signUrl from S3. When I make the call with special characters like %, my code does not parse it correctly and I receive a 404 not found error. Here is the ajax request I am using: My API setup: app.get('/websi ...

Utilize the composition API in Vue.js 3 to call a function and pass in a parameter

I'm having trouble calling a function from another component. When I click on a button in my parent component, formTelemarketing(), it should send data to my other component nAsignedCalls() and call the function getCalls(param) in that component. Thi ...

Choose options with identical titles

If you click on the button to add more selects with the same name, I want to replace them so that you can access them in a PHP array. document.querySelector('#add').onclick = function () { var thespan = document.createElement('span&apos ...

When the mouse drags across the empty space, the force graph continually jumps

I have some questions. I utilized a force graph and added zoom functionality to it. However, when I drag the mouse over the blank area, the force graph keeps jumping erratically. like this Is there a way to prevent the graph from jumping? Thank you. ( ...

Restore the button to its original color when the dropdown menu is devoid of options

Is it possible to change the button colors back to their original state automatically when a user deselects all options from my dropdown menu? The user can either uncheck each option box individually or click on the "clear" button to clear all selections. ...

Validate if the Jquery AJAX response contains any data

I've been attempting to integrate an alert message in my code that triggers if the response is null, but every time I try to do so, something goes wrong. If anyone has any suggestions or assistance with this issue, it would be greatly appreciated. He ...

Utilizing document.write to switch up the content on the page

Every time I attempt to utilize document.write, it ends up replacing the current HTML page content. For instance, consider this HTML code: <body> <div> <h1>Hello</h1> </div> and this jQuery code: var notif = document. ...

Unable to locate element using document.getElementById in ASP.NET form

Currently, I am working on a project to create an ASP.NET webforms page that will showcase a Google map using the Google Maps JavaScript API with multiple markers. Everything is functioning smoothly as long as I don't place <div id="map-canvas"> ...

Ways to retrieve the innerHTML of a Script Tag

After spending what feels like an eternity searching, I still can't figure out how to get the innerHTML of a script tag. Here's where I'm at... <script type="text/javascript" src="http://www.google.com" id="externalScript"></script ...