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

Android: Fetching Geolocation from background service causes crash on SDK > 22

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Release 6.0.1
    • Fix Version/s: Release 6.0.2
    • Component/s: None
    • Labels:
      None
    • Story Points:
      3
    • Sprint:
      2017 Sprint 02 SDK

      Description

      File: android/modules/geolocation/src/java/ti/modules/titanium/geolocation/GeolocationModule.java

      Method:
      hasLocationPermissions()

      The method checks permission on the current Activity, but it might be null when running in a service.

      One solution is to change

      Activity currentActivity = TiApplication.getInstance().getCurrentActivity();
      if (currentActivity.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {

      To

      Context context = TiApplication.getInstance().getApplicationContext();
      if (context.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {

        Attachments

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              jonasbjurhult Jonas Bjurhult
              Reviewer:
              Andy Waldman
            • Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • It looks like Backbone Issue Sync is not enabled for your project.

                  Git Source Code