javascript – iOS Cordova Geolocation not prompting for Location Permission

0
1
javascript – iOS Cordova Geolocation not prompting for Location Permission


I’m constructing a iOS in-house Time Card app, and I added performance to trace consumer clock-in location. This shall be used to only to get a fundamental concept of the place the consumer clocked in.

The problem I’m going through is the immediate for location entry is rarely given to the consumer. Which makes the situation seize at all times fail.

I’ve carried out the privateness settings for the information.plist, nevertheless, it’s nonetheless not showing.

Right here is my config.xml



    WorkHour
    Time Card App for BL Ductless
    [email protected]" href="https://blductless.com">
        BL Ductless
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        
            Your location is used to trace the place you clock-in.
          
          
            Your location is used to trace the place you clock-in/work on initiatives.
          

          
          
            
            
          
          
            
            
          

          
          
            
              
                NSPrivacyAccessedAPITypesIdentifier
                Location
                NSPrivacyAccessedAPITypesPurpose
                To substantiate right location when updating time card standing (clock in, clock out, edit time card)
              
            
          

 
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    


Am I lacking one thing? The whole lot I’ve learn within the documentation has proven that that is the setup required to make use of Geolocation in iOS (nevertheless outdated).

I’ve verified that the app has not beforehand requested for permission, in my settings it says “Permit location when prompted” which is meant conduct for a software that has not but prompted for location use.

For reference, here’s a snippet of my JavaScript clock-in performance:

// Clock In.
        window.clockInTime = new Date();
        window.clockedIn = true;
        clockBtn.innerText = "Clock Out";
        doc.getElementById("statusLabel").innerText = "Clocked In";
        window.timerInterval = setInterval(updateTimer, 1000);
        var finalAddress = "";
        navigator.geolocation.getCurrentPosition(onSuccessGetLocation, onErrorGetLocation);

        perform onSuccessGetLocation(place) {
            var msg =
              'Latitude: '           + place.coords.latitude         + 'n' +
              'Longitude: '          + place.coords.longitude        + 'n' +
              'Altitude: '           + place.coords.altitude         + 'n' +
              'Accuracy: '           + place.coords.accuracy         + 'n' +
              'Altitude Accuracy: '  + place.coords.altitudeAccuracy + 'n' +
              'Heading: '            + place.coords.heading          + 'n' +
              'Velocity: '              + place.coords.pace            + 'n' +
              'Timestamp: '          + place.timestamp;

              nativegeocoder.reverseGeocode(reverseLocationSuccess, reverseLocationFailure, place.coords.latitude, place.coords.longitude, { useLocale: true, maxResults: 1 });
        }


        // onError Callback receives a PositionError object
        //
        perform onErrorGetLocation(error) {
          
        }

        perform reverseLocationSuccess(outcome) {
          var firstResult = outcome[0] || {};
          // extract the items you need
          var road = firstResult.thoroughfare     || '';
          var metropolis   = firstResult.locality         || '';
          var state  = firstResult.administrativeArea || '';

          // be part of them with commas, skipping any empty values
          var formattedAddress = [street, city, state]
            .filter(perform(half) { return half.size; })
            .be part of(', ');
          finalAddress = formattedAddress;
          console.log('Formatted Tackle:', formattedAddress);
          fetch("redacted", {
          technique: "POST",
          headers: { "Content material-Kind": "software/json" },
          physique: JSON.stringify({
            employeeId: worker.id,
            clockInTime: window.clockInTime.toISOString(),
            projectId: projectId,
            location: finalAddress
          })
        })
          .then(r => r.json())
          .then(d => console.log("Clock in recorded:", d))
          .catch(e => console.error("Error clocking in:", e));
        }

I tried to switch my information.plist with right location permissions and utilization descriptions, ran on actual {hardware}, ran unit exams with a take a look at configuration with location set to a specified entry, and switched geolocation plugins.

LEAVE A REPLY

Please enter your comment!
Please enter your name here