D/CordovaActivity: Resumed the activity.
I/TripDiaryStateMachineRcvr: noarg constructor called
I/TripDiaryStateMachineRcvr: TripDiaryStateMachineReciever onReceive(android.app.ReceiverRestrictedContext@478dc97, Intent { act=local.transition.initialize flg=0x10 cmp=edu.berkeley.eecs.emission/.cordova.tracker.location.TripDiaryStateMachineReceiver }) called
I/System.out: About to execute query SELECT data FROM userCache WHERE key = 'intro_done' AND type = 'local-storage' AND write_ts >= 0.0 AND write_ts <= 1.50318631821E12 ORDER BY write_ts DESC
I/TripDiaryStateMachineRcvr: onboarding is not complete, skipping prompt
I/TripDiaryStateMachineService: Service created. Initializing one-time variables!
D/TripDiaryStateMachineService: service started with flags = 0 startId = 1 action = local.transition.initialize
D/TripDiaryStateMachineService: after reading from the prefs, the current state is local.state.start
D/BuiltinUserCache: Added value for key statemachine/transition at time 1.50318631841E9
D/TripDiaryStateMachineService: Launched connect to the google API client, returning from onStartCommand
I/TransitionNotificationReceiver: noarg constructor called
I/TransitionNotificationReceiver: TripDiaryStateMachineReciever onReceive(android.app.ReceiverRestrictedContext@478dc97, Intent { act=local.transition.initialize flg=0x10 cmp=edu.berkeley.eecs.emission/.cordova.transitionnotify.TransitionNotificationReceiver }) called
D/TransitionNotificationReceiver: Received platform-specification notification local.transition.initialize
D/TripDiaryStateMachineService: onConnected(null) called
D/TripDiaryStateMachineService: handleAction(local.state.start, local.transition.initialize) calle
D/BuiltinUserCache: Added value for key background/battery at time 1.503186318536E9
D/TripDiaryStateMachineService: TripDiaryStateMachineReceiver handleStarted(local.transition.initialize) called
I/System.out: Running in new thread!!
I/TripDiaryStateMachineRcvr: noarg constructor called
I/TripDiaryStateMachineRcvr: TripDiaryStateMachineReciever onReceive(android.app.ReceiverRestrictedContext@478dc97, Intent { act=local.transition.initialize flg=0x10 cmp=edu.berkeley.eecs.emission/.cordova.tracker.location.TripDiaryStateMachineReceiver }) called
I/System.out: About to execute query SELECT data FROM userCache WHERE key = 'intro_done' AND type = 'local-storage' AND write_ts >= 0.0 AND write_ts <= 1.503186318567E12 ORDER BY write_ts DESC
I/TripDiaryStateMachineRcvr: onboarding is not complete, skipping prompt
D/TripDiaryStateMachineService: service started with flags = 0 startId = 2 action = local.transition.initialize
D/CreateGeofenceAction: Last location would have been Location[fused 37.390643,-122.086363 acc=44 et=+5d4h11m38s117ms] if we hadn't reset it
D/TripDiaryStateMachineService: after reading from the prefs, the current state is local.state.start
D/CreateGeofenceAction: Last location is Location[fused 37.390643,-122.086363 acc=44 et=+5d4h11m38s117ms] using it
D/BuiltinUserCache: Added value for key statemachine/transition at time 1.50318631859E9
D/CreateGeofenceAction: creating geofence at location Location[fused 37.390643,-122.086363 acc=44 et=+5d4h11m38s117ms]
D/TripDiaryStateMachineService: client is already connected, can directly handle the action
D/CreateGeofenceAction: creating geofence at location 37.3906431, -122.0863631
D/TripDiaryStateMachineService: handleAction(local.state.start, local.transition.initialize) calle
D/BuiltinUserCache: Added value for key background/battery at time 1.503186318627E9
D/TripDiaryStateMachineService: TripDiaryStateMachineReceiver handleStarted(local.transition.initialize) called
I/System.out: Running in new thread!!
D/TripDiaryStateMachineService: Launched connect to the google API client, returning from onStartCommand
I/TransitionNotificationReceiver: noarg constructor called
I/TransitionNotificationReceiver: TripDiaryStateMachineReciever onReceive(android.app.ReceiverRestrictedContext@478dc97, Intent { act=local.transition.initialize flg=0x10 cmp=edu.berkeley.eecs.emission/.cordova.transitionnotify.TransitionNotificationReceiver }) called
D/CreateGeofenceAction: Last location would have been Location[fused 37.390643,-122.086363 acc=44 et=+5d4h11m38s189ms] if we hadn't reset it
D/TransitionNotificationReceiver: Received platform-specification notification local.transition.initialize
D/CreateGeofenceAction: Last location is Location[fused 37.390643,-122.086363 acc=44 et=+5d4h11m38s189ms] using it
D/TripDiaryStateMachineService: newState after handling action is local.state.waiting_for_trip_start
Sometimes this even fails.
D/CreateGeofenceAction: creating geofence at location Location[fused 37.390643,-122.086363 acc=44 et=+5d4h11m38s189ms]
D/TripDiaryStateMachineService: newState saved in prefManager is local.state.waiting_for_trip_start
D/CreateGeofenceAction: creating geofence at location 37.3906431, -122.0863631
E/AndroidRuntime: FATAL EXCEPTION: Thread-6780
Process: edu.berkeley.eecs.emission, PID: 2667
java.lang.IllegalStateException: GoogleApiClient is not connected yet.
at com.google.android.gms.internal.zzaas.zzb(Unknown Source)
at com.google.android.gms.internal.zzaav.zzb(Unknown Source)
at com.google.android.gms.internal.zzaat.zzb(Unknown Source)
at com.google.android.gms.internal.zzasb.addGeofences(Unknown Source)
at edu.berkeley.eecs.emission.cordova.tracker.location.actions.GeofenceActions.createGeofenceAtLocation(GeofenceActions.java:91)
at edu.berkeley.eecs.emission.cordova.tracker.location.actions.GeofenceActions.create(GeofenceActions.java:71)
at edu.berkeley.eecs.emission.cordova.tracker.location.TripDiaryStateMachineService$3.run(TripDiaryStateMachineService.java:437)
at java.lang.Thread.run(Thread.java:818)
I/TripDiaryStateMachineService: Service destroyed. So long, suckers!
We need to only start after the "I agree" button is clicked.
While testing the changes for https://github.com/e-mission/cordova-jwt-auth/issues/17, I uninstalled and re-installed multiple times. I then noticed that tracking started even before the user agreed to the terms.
Sometimes this even fails.
We need to only start after the "I agree" button is clicked.