Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28140

Android: WebView should request location permission when HTML uses geolocation API

    Details

    • Story Points:
      5
    • Sprint:
      2020 Sprint 19

      Description

      Summary:
      When a WebView HTML's JavaScript uses the Geolocation web API, it should automatically prompt the end-user for permission on Android 6.0 and above.

      Currently, permission will always be denied unless you call the Ti.Geolocation.requestLocationPermissions() method yourself before loading the webpage.

      Test Case:

      1. Create a Classic Titanium app project.
      2. Add the below Android permission to the "tiapp.xml".
      3. Use the below "app.js" code.
      4. Build and run on Android 6.0 or higher.
      5. Tap on the "Your Location" button in the map.
      6. Verify a dialog appears asking you for permission. (This is the feature we're adding.)
      7. Grant permission.
      8. Verify map shows your current location.

      tiapp.xml

      <ti:app>
      	<android>
      		<manifest>
      			<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
      		</manifest>
      	</android>
      </ti:app>
      

      app.js

      var window = Ti.UI.createWindow();
      window.add(Ti.UI.createWebView({
      	url: 'https://maps.google.com',
      	borderRadius: 1,
      }));
      window.open();
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              jquick Joshua Quick
              Reviewer:
              Gary Mathews
              Tester:
              Sohail Saddique
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration