Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Motionchange event will not trigger #146

Closed
locsim opened this issue Nov 14, 2019 · 6 comments
Closed

Motionchange event will not trigger #146

locsim opened this issue Nov 14, 2019 · 6 comments

Comments

@locsim
Copy link

locsim commented Nov 14, 2019

Hello, please find the problem description here below.

Your Environment

  • Plugin version: 1.3.2
  • Platform: Android
  • OS version: 9
  • Device manufacturer / model: OnePlus 5T (also tested on Samsung xcover 4)
  • Flutter info:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [version 10.0.18362.476], locale fr-FR)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[√] Connected device (1 available)

• No issues found!

  • Plugin config:
@override
  void initState() {
    super.initState();
      
    bg.BackgroundGeolocation.ready(bg.Config(
        params: {
          'x': appSetup.x
        },
        debug: false,
        logLevel:  bg.Config.LOG_LEVEL_VERBOSE,
        minimumActivityRecognitionConfidence: 50,

        startOnBoot: false,
        distanceFilter: 50,
        heartbeatInterval: 120,
        desiredAccuracy: bg.Config.DESIRED_ACCURACY_HIGH,
        useSignificantChangesOnly: false,
        notification:
        bg.Notification(title: "XXXXX", text: "Localisation en cours"),
        stopOnTerminate: true,
        stopTimeout: 0,
        reset: true,
        url: 'https://xxxxxxxx'
    ))
        .then((bg.State state) {
      if (!state.enabled) {
        bg.BackgroundGeolocation.start();
      }
    });
        }

Expected Behavior

I expect to see a motionchange event occur in the log when shaking the phone.

Actual Behavior

Unstead, only one motionchange event occur (when the app is launched), and even when shaking the phone for quite a long time (say 30s) I simply can't trigger this event again.
Same for motion transition event.

Steps to Reproduce

launch the app and shake the phone

Context

Debug logs

Launching lib\main.dart on ONEPLUS A5010 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
[flutter_background_geolocation] Purging debug resources in release build
Built build\app\outputs\apk\debug\app-debug.apk.
Installing build\app\outputs\apk\app.apk...
I/TSLocationManager( 4539): [c.t.l.BootReceiver$1 run]
I/TSLocationManager( 4539): ╔═════════════════════════════════════════════
I/TSLocationManager( 4539): ║ BootReceiver: com.locsim.bg_test
I/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): ╟─ android.intent.action.MY_PACKAGE_REPLACED
D/TSLocationManager( 4539): [c.t.l.g.TSGeofenceManager c] ℹ️ Persist monitored geofences: []
W/.locsim.bg_tes( 4539): Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (light greylist, reflection)
W/.locsim.bg_tes( 4539): Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (light greylist, reflection)
W/.locsim.bg_tes( 4539): Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (light greylist, reflection)
W/.locsim.bg_tes( 4539): Accessing hidden method Landroid/util/LongArray;->get(I)J (light greylist, reflection)
D/DecorView( 4539): onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@37f8616[MainActivity]
I/OpenGLRenderer( 4539): Initialized EGL, version 1.4
D/OpenGLRenderer( 4539): Swap behavior 2
Syncing files to device ONEPLUS A5010...
D/TSLocationManager( 4539): [c.t.l.adapter.TSConfig c] ℹ️ Persist config, dirty: [desiredAccuracy, distanceFilter, headlessJobService, heartbeatInterval, logLevel, minimumActivityRecognitionConfidence, notification, notification.title, notification.text, params, stopTimeout]
D/TSLocationManager( 4539): [c.t.l.a.BackgroundGeolocation ready] LocationPermission :true
I/Choreographer( 4539): Skipped 52 frames! The application may be doing too much work on its main thread.
I/OpenGLRenderer( 4539): Davey! duration=919ms; Flags=1, IntendedVsync=519849818813634, Vsync=519850685480266, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=519850688593929, AnimationStart=519850688671013, PerformTraversalsStart=519850689476169, DrawStart=519850696461742, SyncQueued=519850699520336, SyncStart=519850699596690, IssueDrawCommandsStart=519850699758148, SwapBuffers=519850737213877, FrameCompleted=519850738607888, DequeueBufferDuration=3140000, QueueBufferDuration=343000,
D/TSLocationManager( 4539): [c.t.locationmanager.util.b a]
D/TSLocationManager( 4539): ℹ️ LocationAuthorization: Permission granted
I/TSLocationManager( 4539): - Enable: false → true, trackingMode: 1
I/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
I/TSLocationManager( 4539): 🎾 Start motion-activity updates
W/ActivityThread( 4539): handleWindowVisibility: no activity for token android.os.BinderProxy@15941ee
I/TSLocationManager( 4539): [c.t.l.g.TSGeofenceManager start]
I/TSLocationManager( 4539): 🎾 Start monitoring geofences
D/TSLocationManager( 4539): [c.t.l.http.HttpService startMonitoringConnectivityChanges]
D/TSLocationManager( 4539): 🎾 Start monitoring connectivity changes
D/TSLocationManager( 4539): [c.t.locationmanager.device.b c]
D/TSLocationManager( 4539): 🎾 Start monitoring powersave changes
I/TSLocationManager( 4539): [c.t.l.g.TSGeofenceManager stopMonitoringSignificantLocationChanges]
I/TSLocationManager( 4539): 🔴 Stop monitoring significant location changes
I/TSLocationManager( 4539): [c.t.l.service.HeartbeatService b]
I/TSLocationManager( 4539): 🎾 Start heartbeat (120s)
D/TSLocationManager( 4539): [c.t.locationmanager.util.b b]
D/TSLocationManager( 4539): ℹ️ LocationAuthorization: Permission granted
D/TSLocationManager( 4539): [c.t.l.http.HttpService a]
D/TSLocationManager( 4539): ╔═════════════════════════════════════════════
D/TSLocationManager( 4539): ║ 📶 Connectivity change: connected? true
D/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): [c.t.l.service.TrackingService a]
I/TSLocationManager( 4539): 🔵 setPace: false → false
D/TSLocationManager( 4539): [c.t.l.adapter.TSConfig translateDesiredAccuracy] translateDesiredAccuracy (true): -1
W/.locsim.bg_tes( 4539): Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/.locsim.bg_tes( 4539): Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
D/DecorView( 4539): onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@4b4e502[TSLocationManagerActivity]
D/DecorView( 4539): onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@37f8616[MainActivity]
I/TSLocationManager( 4539): [c.t.l.s.TSScheduleManager oneShot]
I/TSLocationManager( 4539): ⏰ Scheduled OneShot: TERMINATE_EVENT in 10000ms (jobID: -1708771588)
D/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
D/TSLocationManager( 4539): 🚘 ️DetectedActivity [type=STILL, confidence=100]
I/TSLocationManager( 4539): [c.t.l.s.LocationRequestService b]
I/TSLocationManager( 4539): ℹ️ Location availability: true
I/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
I/TSLocationManager( 4539): ╔═════════════════════════════════════════════
I/TSLocationManager( 4539): ║ Motion Transition Result
I/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): ╟─ 🎾 ENTER: still
I/TSLocationManager( 4539): ╚═════════════════════════════════════════════
D/TSLocationManager( 4539): [c.t.l.http.HttpService a]
D/TSLocationManager( 4539): ╔═════════════════════════════════════════════
D/TSLocationManager( 4539): ║ 📶 Connectivity change: connected? true
D/TSLocationManager( 4539): ╠═════════════════════════════════════════════
D/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService onDestroy]
D/TSLocationManager( 4539): 🔴 ActivityRecognitionService destroyed
D/TSLocationManager( 4539): [c.t.l.http.HttpService a]
D/TSLocationManager( 4539): ╔═════════════════════════════════════════════
D/TSLocationManager( 4539): ║ 📶 Connectivity change: connected? false
D/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): [c.t.l.s.LocationRequestService a]
I/TSLocationManager( 4539): ╔═════════════════════════════════════════════
I/TSLocationManager( 4539): ║ motionchange LocationResult: 1
I/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): ╟─ 📍 Location[fused 43,618491,7,065877 hAcc=16 et=+13d14h20m20s69ms vAcc=??? sAcc=??? bAcc=??? {Bundle[{}]}], age: 734ms, time: 1573752693667
I/TSLocationManager( 4539): [c.t.l.l.TSLocationManager onSingleLocationResult]
I/TSLocationManager( 4539): 🔵 Acquired motionchange position, isMoving: false
D/TSLocationManager( 4539): [c.t.l.s.LocationRequestService onDestroy]
D/TSLocationManager( 4539): [c.t.l.l.TSLocationManager calculateMedianAccuracy] Median accuracy: 16.0
D/TSLocationManager( 4539): [c.t.l.s.LocationRequestService a] SingleLocationRequest 1 isFinished? true
I/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
I/TSLocationManager( 4539): 🎾 Start motion-activity updates
D/TSLocationManager( 4539): [c.t.l.g.TSGeofenceManager startMonitoringStationaryRegion]
D/TSLocationManager( 4539): 🎾 Start monitoring stationary region (radius: 150.0m 43.6184913,7.0658765 hAcc=16.0)
I/TSLocationManager( 4539): [c.t.l.data.sqlite.b persist]
I/TSLocationManager( 4539): ✅ INSERT: c2678c04-266c-4910-bd99-0b696d1b4e31
I/TSLocationManager( 4539): [c.t.l.service.TrackingService h]
I/TSLocationManager( 4539): ╔═════════════════════════════════════════════
I/TSLocationManager( 4539): ║ TrackingService motionchange: false
I/TSLocationManager( 4539): ╠═════════════════════════════════════════════
D/SharedPreferencesImpl( 4539): Time required to fsync /data/user/0/com.locsim.bg_test/shared_prefs/TSLocationManager.xml: [<1: 0, <2: 0, <4: 0, <8: 0, <16: 0, <32: 0, <64: 0, <128: 0, <256: 0, <512: 0, <1024: 1, <2048: 0, <4096: 0, <8192: 0, <16384: 0, >=16384: 0]
D/QueuedWork( 4539): waited: [<1: 0, <2: 2, <4: 0, <8: 0, <16: 0, <32: 0, <64: 0, <128: 0, <256: 0, <512: 0, <1024: 1, <2048: 0, <4096: 0, <8192: 0, <16384: 0, >=16384: 0]
D/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
D/TSLocationManager( 4539): 🚘 ️DetectedActivity [type=STILL, confidence=100]
D/TSLocationManager( 4539): [c.t.l.service.TrackingService onDestroy]
D/TSLocationManager( 4539): 🔴 TrackingService destroyed
D/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
D/TSLocationManager( 4539): 🚘 ️DetectedActivity [type=STILL, confidence=100]
I/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
I/TSLocationManager( 4539): ╔═════════════════════════════════════════════
I/TSLocationManager( 4539): ║ Motion Transition Result
I/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): ╟─ 🎾 ENTER: still
I/TSLocationManager( 4539): ╚═════════════════════════════════════════════
I/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService a]
I/TSLocationManager( 4539): ╔═════════════════════════════════════════════
I/TSLocationManager( 4539): ║ Motion Transition Result
I/TSLocationManager( 4539): ╠═════════════════════════════════════════════
I/TSLocationManager( 4539): ╟─ 🎾 ENTER: still
I/TSLocationManager( 4539): ╚═════════════════════════════════════════════
D/TSLocationManager( 4539): [c.t.l.s.ActivityRecognitionService onDestroy]
D/TSLocationManager( 4539): 🔴 ActivityRecognitionService destroyed
D/DecorView( 4539): onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@37f8616[MainActivity]

PASTE_YOUR_LOGS_HERE
@christocracy
Copy link
Member

Keep shaking. You'll see a Motion Transition Result ENTER: on_foot

@locsim
Copy link
Author

locsim commented Nov 14, 2019

Hi Chris,
Thank you for answering.
I've been shaking the phone for 2 minutes (yes, 120 seconds).
Only heartbeat triggers every 2mn.

@christocracy
Copy link
Member

Go outside for a walk. See http://dontkillmyapp.com.

@locsim
Copy link
Author

locsim commented Nov 14, 2019

I know some manufactures can silently shut down some process but:
The app is foreground and the service was not killed (since heartbeat goes on triggering).

@christocracy
Copy link
Member

Doesn’t matter. It’s not an issue with the app being killed. Follow all steps for your device at dontkillmyapp.com then go outside for a 1km walk with debug: true.

@locsim
Copy link
Author

locsim commented Nov 15, 2019

Ok it works: motionchange event triggers. What is really strange is that you can't fool it easyly: I was not able to trigger it by simply shaking the phone: I had to really walk. The system motion detection is obviously a smart thing .
Thank you for your help Chris.

@locsim locsim closed this as completed Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants