transistorsoft / flutter_background_geolocation

Sophisticated, battery-conscious background-geolocation & geofencing with motion-detection
https://www.transistorsoft.com/shop/products/flutter-background-geolocation
Other
640 stars 237 forks source link

bg.Logger.uploadLog throws an exception without error details #724

Closed cto-seak-global closed 3 months ago

cto-seak-global commented 2 years ago

Your Environment

• No issues found!

Expected Behavior

When uploading logs, I expect the upload either to succeed or to fail with a helpful error code

Actual Behavior

A platform exception is generated, containing no error information (status code and all other exception parameters are null or empty).

Steps to Reproduce

  1. At any point in the code, make a call to bg.Logger.uploadLog() with a valid URL.

Context

I was trying to upload logs to our server in response to a silent push notification.

Debug logs

Logs ``` Not currently available -- will attempt to add ```
christocracy commented 2 years ago

What does $ adb logcat show?

cto-seak-global commented 2 years ago

I'm trying to get hold of that now

cto-seak-global commented 2 years ago

--------- beginning of crash --------- beginning of system --------- beginning of main 03-15 14:12:38.115 19139 19309 I TSLocationManager: - Enable: true → true, trackingMode: 1

christocracy commented 2 years ago

Ensure verbose logging

christocracy commented 2 years ago

And don’t provide a filter to logcat (-s, *:S)

cto-seak-global commented 2 years ago

03-15 14:34:07.706 1170 4759 V ActivityManager: New death recipient com.android.server.am.ActivityManagerService$AppDeathRecipient@dd59cda for thread android.os.BinderProxy@45a650b 03-15 14:34:07.710 620 688 I libPowerHal: [perfNotifyAppState] foreground:android, pid:23249, uid:1000 03-15 14:34:07.710 1170 4759 W WindowManager: Changing focus fromWindow{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} to null displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:459 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:5626 com.android.server.wm.DisplayContent.setFocusedApp:5517 com.android.server.wm.ActivityTaskManagerService.setResumedActivityUncheckLocked:5555 03-15 14:34:07.710 620 688 E UxUtility: notifyAppState error = NULL 03-15 14:34:07.710 620 688 I TouchUtility: notifyAppState error = NULL 03-15 14:34:07.710 620 634 I mtkpower@impl: [notifyAppState] pc:1, com.seakglobal.safe.dev => android 03-15 14:34:07.717 1170 4759 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.717 1170 4759 I InputDispatcher: Focus left window: Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} in display 0 03-15 14:34:07.722 23249 23249 D NetworkSecurityConfig: No Network Security Config specified, using platform default 03-15 14:34:07.722 23249 23249 D NetworkSecurityConfig: No Network Security Config specified, using platform default 03-15 14:34:07.727 23249 23270 D libMEOW : meow reload base cfg path: na 03-15 14:34:07.727 23249 23270 D libMEOW : meow reload overlay cfg path: na 03-15 14:34:07.727 23249 23270 D libMEOW : applied 0 plugin for [android:ui]. 03-15 14:34:07.728 638 638 I SurfaceFlinger: operator()(), mtkRenderCntDebug 406554, screenshot (com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0) 03-15 14:34:07.732 1170 4759 V SettingsProvider: packageValueForCallResult, name = null, value : Bundle[{_track_generation=android.util.MemoryIntArray@88, value=null, _generation_index=0, _generation=6312}] 03-15 14:34:07.733 1170 4759 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.735 23249 23249 W ChooserActivity: Ignoring intent's EXTRA_TITLE, deprecated in P. You may wish to set a preview title by using EXTRA_TITLE property of the wrapped EXTRA_INTENT. 03-15 14:34:07.736 1170 3983 V SettingsProvider: packageValueForCallResult, name = null, value : Bundle[{_track_generation=android.util.MemoryIntArray@88, value=null, _generation_index=2, _generation=3156}] 03-15 14:34:07.740 1170 3790 E IntervalStats: Unable to parse usage stats package 524 03-15 14:34:07.744 23249 23249 W ContextImpl: Failed to ensure /data/system/shared_prefs: mkdir failed: EACCES (Permission denied) 03-15 14:34:07.754 31458 23238 W NetworkScheduler: Error inserting flex_time=3135000 job_id=-1 period=6272000 source=16 requires_charging=0 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService user_id=0 target_package=com.google.android.gms tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG task_type=0 required_idleness_state=0 service_kind=0 source_version=220618000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1647354847752 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} last_runtime=0, error message: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE) [CONTEXT service_id=218 ] 03-15 14:34:07.760 23249 23273 D AbstractResolverComp: Setting watchdog timer for 500ms 03-15 14:34:07.763 1170 4759 D CompatibilityChangeReporter: Compat change id reported: 136274596; UID 1000; state: ENABLED 03-15 14:34:07.791 869 954 D AAL : 03-15 02:34:07.693 BL= 463,ESS= 256, 03-15 02:34:07.709 BL= 464,ESS= 256, 03-15 02:34:07.743 BL= 465,ESS= 256, 03-15 02:34:07.759 BL= 466,ESS= 256, 03-15 02:34:07.791 BL= 467,ESS= 256, 03-15 14:34:07.792 23249 23249 D ChooserActivity: System Time Cost is 57 03-15 14:34:07.800 23249 23249 I SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@7ef7081 03-15 14:34:07.800 638 1111 I SurfaceFlinger: [SF client] NEW(0xb400007df8c30850) for (23249:android:ui) 03-15 14:34:07.802 23249 23249 D ViewRootImpl[ChooserActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false 03-15 14:34:07.804 638 1111 I SurfaceFlinger: [SF client] NEW(0xb400007df8c33250) for (1170:system_server) 03-15 14:34:07.806 23249 23249 D libMEOW : applied 0 plugin for [android:ui]. 03-15 14:34:07.806 23249 23249 I InputTransport: Create ARC handle: 0xb400007bffccd360 03-15 14:34:07.807 23249 23249 V PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@72193bd, this = DecorView@57dadb2[ChooserActivity] 03-15 14:34:07.807 1170 4759 I LongScreenshotHelper: mActivityRecord = ActivityRecord{a7eacd u0 android/com.android.internal.app.ChooserActivity t3652} mHctApplication = android.app.IHctApplicationThread$Stub$Proxy@f856663 03-15 14:34:07.807 1170 4759 E ApplockService_TAG: AppLockService------------->pkg = android className = com.android.internal.app.ChooserActivity mCanStartWatch = true 03-15 14:34:07.810 23249 23249 D ChooserActivity: querying direct share targets from ShortcutManager 03-15 14:34:07.810 23249 23249 D ChooserActivity: List built querying services 03-15 14:34:07.811 23249 23249 D ChooserActivity: queryTargets setting watchdog timer for 1500-10000ms 03-15 14:34:07.816 1170 4759 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.819 1170 4759 I WindowManager: Relayout Window{ea1021d u0 android/com.android.internal.app.ChooserActivity}: oldVis=4 newVis=0 focusMayChange = true 03-15 14:34:07.821 638 1111 I BufferQueueConsumer: connect(): controlledByApp=false 03-15 14:34:07.821 638 1111 I BufferQueue: unnamed-638-9062 BufferQueue core=(638:/system/bin/surfaceflinger) 03-15 14:34:07.822 1170 4759 W WindowManager: Changing focus fromnull to Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} displayId=0 Callers=com.android.server.wm.RootWindowContainer.updateFocusedWindowLocked:459 com.android.server.wm.WindowManagerService.updateFocusedWindowLocked:5626 com.android.server.wm.WindowManagerService.relayoutWindow:2406 com.android.server.wm.Session.relayout:213 03-15 14:34:07.826 23249 23268 D libMEOW : applied 0 plugin for [android:ui]. 03-15 14:34:07.832 1170 3790 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} android/com.android.internal.app.ChooserActivity#0 Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.833 25252 25252 V PhoneWindow: DecorView setVisiblity: visibility = 8, Parent = android.view.ViewRootImpl@e30c201, this = DecorView@13242e7[InputMethod] 03-15 14:34:07.838 638 2454 I BufferQueueProducer: android/com.android.internal.app.ChooserActivity#0 connect(): api=1 producerControlledByApp=false 03-15 14:34:07.840 22891 22911 E DatabaseUtils: Writing exception to parcel 03-15 14:34:07.840 22891 22911 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.transistorsoft.locationmanager.util.LogFileProvider uri content://com.seakglobal.safe.dev.tslocationmanager.fileprovider/tslocationmanager/background-geolocation.log.gz from pid=23249, uid=1000 requires the provider be exported, or grantUriPermission() 03-15 14:34:07.840 22891 22911 E DatabaseUtils: at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820) 03-15 14:34:07.840 22891 22911 E DatabaseUtils: at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684) 03-15 14:34:07.840 22891 22911 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:239) 03-15 14:34:07.840 22891 22911 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106) 03-15 14:34:07.840 22891 22911 E DatabaseUtils: at android.os.Binder.execTransactInternal(Binder.java:1154) 03-15 14:34:07.840 22891 22911 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:1123) 03-15 14:34:07.840 23249 23249 W ChooserActivity: Could not load (content://com.seakglobal.safe.dev.tslocationmanager.fileprovider/tslocationmanager/background-geolocation.log.gz) thumbnail/name for preview. If desired, consider using Intent#createChooser to launch the ChooserActivity, and set your Intent's clipData and flags in accordance with that method's documentation 03-15 14:34:07.841 638 638 I SurfaceFlinger: operator()(), mtkRenderCntDebug 406555, screenshot (com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0) 03-15 14:34:07.850 1170 3790 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.850 1170 3790 I InputDispatcher: Window went away: android/com.android.internal.app.ChooserActivity#0 03-15 14:34:07.857 23249 23249 W View : requestLayout() improperly called by com.android.internal.widget.RecyclerView{d7702c5 VFED..... ......ID 0,0-720,1346 #102042d android:id/resolver_list} during layout: running second layout pass 03-15 14:34:07.862 22891 22911 E DatabaseUtils: Writing exception to parcel 03-15 14:34:07.862 22891 22911 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.transistorsoft.locationmanager.util.LogFileProvider uri content://com.seakglobal.safe.dev.tslocationmanager.fileprovider/tslocationmanager/background-geolocation.log.gz from pid=23249, uid=1000 requires the provider be exported, or grantUriPermission() 03-15 14:34:07.862 22891 22911 E DatabaseUtils: at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820) 03-15 14:34:07.862 22891 22911 E DatabaseUtils: at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684) 03-15 14:34:07.862 22891 22911 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:239) 03-15 14:34:07.862 22891 22911 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106) 03-15 14:34:07.862 22891 22911 E DatabaseUtils: at android.os.Binder.execTransactInternal(Binder.java:1154) 03-15 14:34:07.862 22891 22911 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:1123) 03-15 14:34:07.863 23249 23249 W ChooserActivity: Could not load (content://com.seakglobal.safe.dev.tslocationmanager.fileprovider/tslocationmanager/background-geolocation.log.gz) thumbnail/name for preview. If desired, consider using Intent#createChooser to launch the ChooserActivity, and set your Intent's clipData and flags in accordance with that method's documentation 03-15 14:34:07.880 23249 23268 E ion : ioctl c0044901 failed with code -1: Invalid argument 03-15 14:34:07.907 869 954 D AAL : 03-15 02:34:07.808 BL= 468,ESS= 256, 03-15 02:34:07.841 BL= 469,ESS= 256, 03-15 02:34:07.857 BL= 470,ESS= 256, 03-15 02:34:07.890 BL= 471,ESS= 256, 03-15 02:34:07.907 BL= 472,ESS= 256, 03-15 14:34:07.929 23249 23249 D AbstractResolverComp: RANKER_SERVICE_RESULT 03-15 14:34:07.931 23249 23249 W View : requestLayout() improperly called by android.widget.LinearLayout{542df07 V.E...... ........ 0,0-720,72 #1020244 android:id/content_preview_file_layout} during second layout pass: posting in next frame 03-15 14:34:07.931 23249 23249 W View : requestLayout() improperly called by android.widget.LinearLayout{3d74834 V.E...... ........ 0,108-720,204 #1020226 android:id/chooser_action_row} during second layout pass: posting in next frame 03-15 14:34:07.931 23249 23249 W View : requestLayout() improperly called by android.widget.Button{6e1c65d VFED..C.. ........ 264,0-456,96} during second layout pass: posting in next frame 03-15 14:34:07.931 1170 3790 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.939 1170 1313 D ArtManagerInternalImpl: /data/misc/iorapd/android/30/com.android.internal.app.ChooserActivity/compiled_traces/compiled_trace.pb doesn't exist 03-15 14:34:07.939 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.whatsapp/com.whatsapp.contact.picker.ContactPicker}, intent component: ComponentInfo{com.whatsapp/com.whatsapp.contact.picker.ContactPicker} 03-15 14:34:07.940 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{org.thoughtcrime.securesms/org.thoughtcrime.securesms.sharing.ShareActivity}, intent component: ComponentInfo{org.thoughtcrime.securesms/org.thoughtcrime.securesms.sharing.ShareActivity} 03-15 14:34:07.940 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{org.telegram.messenger/org.telegram.ui.LaunchActivity}, intent component: ComponentInfo{org.telegram.messenger/org.telegram.ui.LaunchActivity} 03-15 14:34:07.940 1170 1313 I ActivityTaskManager: Displayed android/com.android.internal.app.ChooserActivity: +267ms 03-15 14:34:07.940 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.microsoft.teams/com.microsoft.skype.teams.views.activities.SplashActivity}, intent component: ComponentInfo{com.microsoft.teams/com.microsoft.skype.teams.views.activities.SplashActivity} 03-15 14:34:07.941 620 635 I mtkpower@impl: [setMode] type:5, enabled:0 03-15 14:34:07.941 620 688 I libPowerHal: [perfLockRel] hdl:45927, idx:0 03-15 14:34:07.941 620 688 I libPowerHal: [PD] scn:0 hdl:45927 hint:11 comm:mtkpower@1.0-se pid:620 03-15 14:34:07.941 638 638 I SurfaceFlinger: operator()(), mtkRenderCntDebug 406556, screenshot (com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0) 03-15 14:34:07.941 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.android.nfc/com.android.nfc.BeamShareActivity}, intent component: ComponentInfo{com.android.nfc/com.android.nfc.BeamShareActivity} 03-15 14:34:07.941 620 634 I mtkpower@impl: [mtkPowerHint] hint:22, hold:0, ext:30, ext_hold:2000 03-15 14:34:07.941 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.google.android.apps.docs/com.google.android.apps.docs.common.shareitem.UploadMenuActivity}, intent component: ComponentInfo{com.google.android.apps.docs/com.google.android.apps.docs.common.shareitem.UploadMenuActivity} 03-15 14:34:07.941 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.google.android.gm/com.google.android.gm.ComposeActivityGmailExternal}, intent component: ComponentInfo{com.google.android.gm/com.google.android.gm.ComposeActivityGmailExternal} 03-15 14:34:07.942 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.Slack/slack.app.ui.HomeActivity}, intent component: ComponentInfo{com.Slack/slack.app.ui.HomeActivity} 03-15 14:34:07.942 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.microsoft.office.outlook/com.microsoft.office.outlook.compose.ComposeLauncherActivity}, intent component: ComponentInfo{com.microsoft.office.outlook/com.microsoft.office.outlook.compose.ComposeLauncherActivity} 03-15 14:34:07.942 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.microsoft.skydrive/com.microsoft.skydrive.intent.actionsend.ReceiveActionSendActivity}, intent component: ComponentInfo{com.microsoft.skydrive/com.microsoft.skydrive.intent.actionsend.ReceiveActionSendActivity} 03-15 14:34:07.942 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.samsung.android.app.simplesharing/com.samsung.android.app.simplesharing.linksharing.ui.broker.BrokerActivity}, intent component: ComponentInfo{com.samsung.android.app.simplesharing/com.samsung.android.app.simplesharing.linksharing.ui.broker.BrokerActivity} 03-15 14:34:07.942 23249 23249 I ResolverListAdapter: Add DisplayResolveInfo component: ComponentInfo{com.samsung.android.oneconnect/com.samsung.android.oneconnect.ui.contentssharing.ContentsSharingActivity}, intent component: ComponentInfo{com.samsung.android.oneconnect/com.samsung.android.oneconnect.ui.contentssharing.ContentsSharingActivity} 03-15 14:34:07.943 620 634 I mtkpower@impl: [mtkPowerHint] hint:21, hold:6000, ext:30, ext_hold:35000 03-15 14:34:07.944 23249 23249 D ChooserActivity: querying direct share targets from ShortcutManager 03-15 14:34:07.944 23249 23249 D ChooserActivity: List built querying services 03-15 14:34:07.944 620 688 I libPowerHal: [perfLockRel] hdl:45928, idx:2 03-15 14:34:07.944 620 688 I libPowerHal: [PD] scn:2 hdl:45928 hint:22 comm:mtkpower@1.0-se pid:620 03-15 14:34:07.946 23249 23249 D ChooserActivity: queryTargets found target with service ComponentInfo{com.samsung.android.app.simplesharing/com.samsung.android.app.simplesharing.service.ShareChooserTargetService} 03-15 14:34:07.946 620 688 I libPowerHal: [perfLockAcq] idx:0 hdl:45930 hint:30 pid:620 duration:2000 => ret_hdl:45930 03-15 14:34:07.946 620 688 I libPowerHal: [PE] scn:0 hdl:45930 hint:30 comm:mtkpower@1.0-se pid:620 03-15 14:34:07.946 23249 23249 E ChooserActivity: Could not look up service ComponentInfo{com.samsung.android.app.simplesharing/com.samsung.android.app.simplesharing.service.ShareChooserTargetService}; component name not found 03-15 14:34:07.947 620 688 I libPowerHal: [perfLockAcq] idx:4 hdl:45931 hint:21 pid:620 duration:6000 => ret_hdl:45931 03-15 14:34:07.947 620 688 I libPowerHal: [PE] scn:4 hdl:45931 hint:21 comm:mtkpower@1.0-se pid:620 03-15 14:34:07.947 23249 23249 D ChooserActivity: queryTargets setting watchdog timer for 1500-10000ms 03-15 14:34:07.947 620 688 I libPowerHal: [perfLockRel] hdl:45929, idx:3 03-15 14:34:07.947 620 688 I libPowerHal: [PD] scn:3 hdl:45929 hint:21 comm:mtkpower@1.0-se pid:620 03-15 14:34:07.948 620 688 I libPowerHal: [perfLockAcq] idx:5 hdl:45932 hint:30 pid:620 duration:35000 => ret_hdl:45932 03-15 14:34:07.948 620 688 I libPowerHal: [PE] scn:5 hdl:45932 hint:30 comm:mtkpower@1.0-se pid:620 03-15 14:34:07.949 1170 1442 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.949 1170 1442 I InputDispatcher: Focus entered window: Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} in display 0 03-15 14:34:07.953 22891 22911 E DatabaseUtils: Writing exception to parcel 03-15 14:34:07.953 22891 22911 E DatabaseUtils: java.lang.SecurityException: Permission Denial: reading com.transistorsoft.locationmanager.util.LogFileProvider uri content://com.seakglobal.safe.dev.tslocationmanager.fileprovider/tslocationmanager/background-geolocation.log.gz from pid=23249, uid=1000 requires the provider be exported, or grantUriPermission() 03-15 14:34:07.953 22891 22911 E DatabaseUtils: at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:820) 03-15 14:34:07.953 22891 22911 E DatabaseUtils: at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:684) 03-15 14:34:07.953 22891 22911 E DatabaseUtils: at android.content.ContentProvider$Transport.query(ContentProvider.java:239) 03-15 14:34:07.953 22891 22911 E DatabaseUtils: at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:106) 03-15 14:34:07.953 22891 22911 E DatabaseUtils: at android.os.Binder.execTransactInternal(Binder.java:1154) 03-15 14:34:07.953 22891 22911 E DatabaseUtils: at android.os.Binder.execTransact(Binder.java:1123) 03-15 14:34:07.954 23249 23249 W ChooserActivity: Could not load (content://com.seakglobal.safe.dev.tslocationmanager.fileprovider/tslocationmanager/background-geolocation.log.gz) thumbnail/name for preview. If desired, consider using Intent#createChooser to launch the ChooserActivity, and set your Intent's clipData and flags in accordance with that method's documentation 03-15 14:34:07.965 1170 3790 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.981 1170 3983 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:07.983 25252 25252 I InputTransport: Create ARC handle: 0xb400007bffd47430 03-15 14:34:07.986 25252 25252 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3210 03-15 14:34:07.987 25252 25252 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2099 checkRepeatedly = false, unlocked = true 03-15 14:34:07.987 25252 25252 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1907 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=android fieldId=16908310 fieldName=null extras=null}, false) 03-15 14:34:07.987 25252 25252 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2099 checkRepeatedly = true, unlocked = true 03-15 14:34:07.989 23249 23249 D ChooserActivity: SHORTCUT_MANAGER_SHARE_TARGET_RESULT 03-15 14:34:07.989 23249 23249 I ChooserListAdapter: parkTargetIntoMemory ComponentInfo{com.whatsapp/com.whatsapp.contact.picker.ContactPicker}, 4 targets 03-15 14:34:07.998 1170 3983 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:08.014 1170 3983 I InputDispatcher: setInputWindows displayId=0 Window{150c5cf u0 NavigationBar0} Window{322aa9a u0 StatusBar} Window{ea1021d u0 android/com.android.internal.app.ChooserActivity} Window{c39e9dd u0 com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity} SurfaceView - com.seakglobal.safe.dev/com.seakglobal.safe.MainActivity#0 Window{108ef80 u0 com.android.systemui.ImageWallpaper} 03-15 14:34:08.014 23249 23249 D ChooserActivity: SHORTCUT_MANAGER_SHARE_TARGET_RESULT

cto-seak-global commented 2 years ago

Looks like it's some kind of file permission denial

christocracy commented 2 years ago

The /example app in this repo (Advanced App) has an uploadLog button in the main menu. It works for me.

Have you tried testing uploadLog with your app in the foreground (ie: not executed via push-request)?

cto-seak-global commented 2 years ago

Yes, I tried that (triggered by a button), with the same result.

christocracy commented 2 years ago

It works here on my Google Pixel 3a @ Android 12.

Can you try on a different device?

christocracy commented 2 years ago
BackgroundGeolocation.uploadLog('http://192.168.11.40:9000/api/upload_log').

I see the request arrive at my demo server running on my localhost.

cto-seak-global commented 2 years ago

Will try on my iPhone. I note that the emailLog() function works correctly, so whatever that does to access the log.gz file does not get hit by the permissions issue.

christocracy commented 2 years ago

Your reported problem was from Android. It’s pointless to test ios.

cto-seak-global commented 2 years ago

OK. I can't connect using am emulator, so until I can get hold of another device I'm stuck with my Ulefone.

I'll see if I can run the example.

christocracy commented 2 years ago

The example uses emailLog. You have to manually change the code to uploadLog

cto-seak-global commented 2 years ago

I've done some digging, and found a few things:

-- When I remove authentication from the endpoint at the back end, the call succeeds. -- There do not appear to be any authentication headers passed to the endpoint.

The lack of errors appears to be because my back end is not sending the correct error messages back, but I would expect the call to the back end to have the same authentication headers as the location update URL.

christocracy commented 2 years ago

It might be true that the plugin is neglecting to add Authorization headers to the request.

cto-seak-global commented 2 years ago

Also, req.body is coming up as empty on my server.

christocracy commented 2 years ago

It’s a multi part form submission. The log file is a file attachment.

you won’t find it in req.body

cto-seak-global commented 2 years ago

Sure, but according to the docs, there should be some metadata: https://transistorsoft.github.io/capacitor-background-geolocation/interfaces/logger.html#uploadlog

christocracy commented 2 years ago

req.params

cto-seak-global commented 2 years ago

I didn't find it in req.params, but the metadata isn't necessary for my use case. Using formidable, the file was available from the multipart form.

Is there a way to include the authorisation headers manually, as those are necessary in order to get a full audit?

christocracy commented 2 years ago

You could try adding directly to Config.headers.

cto-seak-global commented 2 years ago

Just for reference, there are also no auth headers sent from iOS. The code comes back as "0" in that case.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

github-actions[bot] commented 3 months ago

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