Codova plugins problems with framework7


#1

please help i am have issues with framework7 with javascript


#2

You need provide some information here for folks to help you.

  1. What starter template did you use?

  2. What plugin is causing issues?

  3. What have you attempted so far?

  4. Can you post a link here to a repo on github with the bare minimum amount of information/configuration needed to reproduce your issue?

If you’re having issues with official cordova plugns, see this issue: [help] Cordova Plugins with Framework7 + Vue?


#3

i am building mobile app and i have to use codova plugins and make it show in my framework7 but it is not showing at all can i send the files and help me look into it


#4

function writeAddressName(latLng) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
“location”: latLng
},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
document.getElementById(“address”).innerHTML = results[0].formatted_address;
else
document.getElementById(“error”).innerHTML += “Unable to retrieve your address” + “
”;
});
}

  function geolocationSuccess(position) {
    var userLatLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
    // Write the formatted address
    writeAddressName(userLatLng);

    var myOptions = {
      zoom : 16,
      center : userLatLng,
      mapTypeId : google.maps.MapTypeId.ROADMAP
    };
    // Draw the map
    var mapObject = new google.maps.Map(document.getElementById("map"), myOptions);
    // Place the marker
    new google.maps.Marker({
      map: mapObject,
      position: userLatLng
    });
    // Draw a circle around the user position to have an idea of the current localization accuracy
    var circle = new google.maps.Circle({
      center: userLatLng,
      radius: position.coords.accuracy,
      map: mapObject,
      fillColor: '#0000FF',
      fillOpacity: 0.5,
      strokeColor: '#0000FF',
      strokeOpacity: 1.0
    });
    mapObject.fitBounds(circle.getBounds());
  }

  function geolocationError(positionError) {
    document.getElementById("error").innerHTML += "Error: " + positionError.message + "<br />";
  }

  function geolocateUser() {
    // If the browser supports the Geolocation API
    if (navigator.geolocation)
    {
      var positionOptions = {
        enableHighAccuracy: true,
        timeout: 10 * 1000 // 10 seconds
      };
      navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError, positionOptions);
    }
    else
      document.getElementById("error").innerHTML += "Your browser doesn't support the Geolocation API";
  }

  window.onload = geolocateUser

that is my javascript code


#5

Address:

that is my div class to call the map so i need to use this in my framework page but is not showing


#6

Don’t send files, it’s better if you make a minimal example and post on github and post the link here.

Again it sounds like the native cordova plugins are not working, others have the same problem but folks have not yet found a fix.

One clue so far:

  1. Make sure your project has cordova.js in the index.html file in www/ directory

  2. In your main.js (or however your project is structured) listen for a deviceready event and once that fires you should be able to access plugins under cordova.plugins.PLUGIN_NAME.

ex.

document.addEventListener('deviceready', () => {
   // If everything is working as expected you should be able to use your plugin kind of like the following
  const myPlugin = cordova.plugins.PLUGIN_NAME
  myPlugin.doSomething( (success) => {console.log(success); }, (err) => { console.log(err); });
 
});

#7

i will tried this but if it is not working i will post the project link and you will help me check it out