react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

React Native Application Crashed when location permission or physical activity is denied

Open rutujakadlag24 opened this issue 2 years ago • 2 comments

Your Environment

  • Plugin version: 4.6.0
  • Platform: iOS or Android - Android
  • OS version: 12
  • Device manufacturer / model: Android Emulator
  • React Native version (react-native -v): 0.64.3
  • Plugin config
{
      distanceFilter: options.distanceInterval || 50,
      stopOnTerminate: true,
      startOnBoot: false,
      stopTimeout: 20,
      enableHeadless: false,
      heartbeatInterval: 60,
      locationAuthorizationRequest: 'Always',
      disableLocationAuthorizationAlert: false,
      locationAuthorizationAlert: {
        titleWhenNotEnabled: 'Location services is not enabled',
        titleWhenOff: 'Location services is off',
        instructions:
          "You must enable 'Always' in Location services for tracking to function properly",
        cancelButton: 'Cancel',
        settingsButton: 'Settings',
      },
      backgroundPermissionRationale: {
        title: "Allow access to this device's location in the background?",
        message: "Please enable 'Allow all the time permission",
        positiveAction: 'Change to Allow all the time',
      },
      extras: {},
      url: <server_url>,
      authorization: <fucntion_that_returns_auth_token>,
      autoSync: true
}

Hi @christocracy, I am using the above config to initialize the react native sdk

Expected Behavior

When I opt for the Deny option on the location permission modal or deny the permission for the physical activity modal, then the application implemented above your sdk should not crash abruptly, rather it should remain in the same state as it was previously.

Actual Behavior

App crashes when location permission or physical activity permission is not provided during the course of start tracking.

Steps to Reproduce

  1. Initialise the plugin
  2. Call the SDK Start Tracking method a. Location permission modal pops up b. Deny the location permission access c. Allow Physical Activity permission access d. App crashed OR b. Allow the location permission access c. Deny Physical Activity permission access d. App crashed

Context

I was testing my application behavior, when location permission is denied.

Debug logs

Logs
03-06 17:47:10.671   505  5188 D libEGL  : loaded /vendor/lib64/egl/libGLESv2_emulation.so
03-06 17:47:10.682  4874  4874 D AndroidRuntime: Shutting down VM
--------- beginning of crash
03-06 17:47:10.683  4874  4874 E AndroidRuntime: FATAL EXCEPTION: main
03-06 17:47:10.683  4874  4874 E AndroidRuntime: Process: com.proximity.deliverysolutions, PID: 4874
03-06 17:47:10.683  4874  4874 E AndroidRuntime: java.lang.AbstractMethodError: abstract method "void com.intentfilter.androidpermissions.PermissionManager$PermissionRequestListener.onPermissionDenied()"
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at com.intentfilter.androidpermissions.PermissionHandler.informPermissionsDenied(PermissionHandler.java:93)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at com.intentfilter.androidpermissions.PermissionHandler.onPermissionsResult(PermissionHandler.java:53)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at com.intentfilter.androidpermissions.PermissionManager.onReceive(PermissionManager.java:58)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at androidx.localbroadcastmanager.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:313)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at androidx.localbroadcastmanager.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:121)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:223)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
03-06 17:47:10.683  4874  4874 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
03-06 17:47:10.683   505  5188 D HostConnection: HostConnection::get() New Host Connection established 0xb400007963c54d50, tid 5188
03-06 17:47:10.691  4874  4874 E TSLocationManager: [c.t.l.a.BackgroundGeolocation$x0 uncaughtException] 
03-06 17:47:10.691  4874  4874 E TSLocationManager:   ‼️  Uncaught Exception: abstract method "void com.intentfilter.androidpermissions.PermissionManager$PermissionRequestListener.onPermissionDenied()"
03-06 17:47:10.691  4874  4874 E TSLocationManager: {"activityRecognitionInterval":10000,"allowIdenticalLocations":false,"authorization":{"strategy":"JWT","accessToken":"<auth_token>","refreshToken":"<referesh_token>","refreshUrl":"<referesh_url>","refreshPayload":{"refresh_token":"{refreshToken}"},"expires":-1},"autoSync":true,"autoSyncThreshold":0,"backgroundPermissionRationale":{"title":"Allow access to this device's location in the background?","message":"Please enable 'Allow all the time permission","positiveAction":"Change to Allow all the time","negativeAction":""},"batchSync":false,"configUrl":"","debug":false,"deferTime":0,"desiredAccuracy":0,"desiredOdometerAccuracy":100,"disableAutoSyncOnCellular":false,"disableElasticity":false,"disableLocationAuthorizationAlert":false,"disableMotionActivityUpdates":false,"disableStopDetection":false,"distanceFilter":20,"elasticityMultiplier":1,"enableHeadless":false,"enableTimestampMeta":false,"extras":{"orderId":"01Mar001"},"fastestLocationUpdateInterval":-1,"foregroundService":true,"geofenceInitialTriggerEntry":true,"geofenceModeHighAccuracy":false,"geofenceProximityRadius":1000,"geofenceTemplate":"","headers":{},"headlessJobService":"com.reactnativedeliverysolution.HeadlessTask","heartbeatInterval":60,"httpRootProperty":"location","httpTimeout":60000,"isMoving":false,"locationAuthorizationRequest":"Always","locationTemplate":"","locationTimeout":60,"locationUpdateInterval":1000,"locationsOrderDirection":"ASC","logLevel":3,"logMaxDays":3,"maxBatchSize":-1,"maxDaysToPersist":1,"maxRecordsToPersist":-1,"method":"POST","minimumActivityRecognitionConfidence":75,"motionTriggerDelay":0,"notification":{"layout":"","title":"","text":"Location Service activated","color":"","channelName":"TSLocationManager","smallIcon":"","largeIcon":"","priority":0,"sticky":false,"strings":{},"actions":[]},"params":{},"persist":true,"persistMode":2,"schedule":[],"scheduleUseAlarmManager":false,"speedJumpFilter":300,"startOnBoot":false,"stationaryRadius":25,"stopAfterElapsedMinutes":0,"stopOnStationary":false,"stopOnTerminate":true,"stopTimeout":20,"triggerActivities":"in_vehicle, on_bicycle, on_foot, running, walking","url":"https:\/\/qa.api.deliverysolutions.co\/proximity\/track","useSignificantChangesOnly":false,"enabled":false,"schedulerEnabled":false,"trackingMode":1,"odometer":0,"isFirstBoot":true,"didLaunchInBackground":false,"didDeviceReboot":false}
03-06 17:47:10.691  4874  4874 E TSLocationManager: java.lang.AbstractMethodError: abstract method "void com.intentfilter.androidpermissions.PermissionManager$PermissionRequestListener.onPermissionDenied()"
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at com.intentfilter.androidpermissions.PermissionHandler.informPermissionsDenied(PermissionHandler.java:93)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at com.intentfilter.androidpermissions.PermissionHandler.onPermissionsResult(PermissionHandler.java:53)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at com.intentfilter.androidpermissions.PermissionManager.onReceive(PermissionManager.java:58)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at androidx.localbroadcastmanager.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:313)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at androidx.localbroadcastmanager.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:121)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at android.os.Handler.dispatchMessage(Handler.java:106)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at android.os.Looper.loop(Looper.java:223)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at android.app.ActivityThread.main(ActivityThread.java:7656)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at java.lang.reflect.Method.invoke(Native Method)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
03-06 17:47:10.691  4874  4874 E TSLocationManager: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
03-06 17:47:10.694   505  5188 D HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV_Cache ANDROID_EMU_vulkan_ignored_handles ANDROID_EMU_has_shared_slots_host_memory_allocator ANDROID_EMU_vulkan_free_memory_sync ANDROID_EMU_vulkan_shader_float16_int8 ANDROID_EMU_vulkan_async_queue_submit ANDROID_EMU_sync_buffer_data ANDROID_EMU_read_color_buffer_dma GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_host_side_tracing ANDROID_EMU_gles_max_version_3_0 
03-06 17:47:10.695   179   179 I hwservicemanager: getTransport: Cannot find entry [email protected]::ISurfaceFlingerConfigs/default in either framework or device manifest.
03-06 17:47:10.695   505  5188 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
03-06 17:47:10.695   505  5188 D EGL_emulation: eglCreateContext: 0xb400007953cd7ed0: maj 3 min 0 rcv 3
03-06 17:47:10.696   505  5188 D EGL_emulation: eglMakeCurrent: 0xb400007953cd7ed0: ver 3 0 (tinfo 0xb4000078f3cd7340) (first time)
03-06 17:47:10.698   505  5189 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
03-06 17:47:10.699   505  4179 W ActivityTaskManager:   Force finishing activity com.proximity.deliverysolutions/.MainActivity
03-06 17:47:10.704  4874  4874 I Process : Sending signal. PID: 4874 SIG: 9
03-06 17:47:10.706   505   547 W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver

rutujakadlag24 avatar Mar 06 '23 14:03 rutujakadlag24

Plugin version: 4.6.0

I suggest you attempt to reproduce using the latest version 4.10.0

christocracy avatar Mar 09 '23 14:03 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 24 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 07 '24 01:06 github-actions[bot]