deckameron / Ti.Android.Geofence

A Geofence solution for Appcelerator Titanium Android
Other
17 stars 5 forks source link

Mock GPS app generating errors in app #7

Open powysm opened 5 years ago

powysm commented 5 years ago

Hi,

I am trying to fake GPS location using this https://play.google.com/store/apps/details?id=com.incorporateapps.fakegps.fre, to test my app, I have also tried others fake gps apps with the same result. I have setup mock location app in settings and can successfully use it to fool StreetView, so it appears to be working ok. However when i try to use it with my ti app i get the following on repeat. And the app fails to pickup the locations.

Ti.android.geofence 1.0.7

Thanks

[INFO] : I/GeofenceModule BroadcastReceiver: (main) [40,63255] onReceive - OnRebootBroadcastReceiver for Geofence : android.location.PROVIDERS_CHANGED [INFO] : I/GeofenceModule BroadcastReceiver: (main) [1,63256] PROVIDERS_CHANGED_ACTION [ERROR] : E/GeofenceModule BroadcastReceiver: (main) [0,63256] java.lang.IllegalArgumentException: Receiver not registered: ti.android.geofence.OnRebootBroadcastReceiver@a2e8160 [INFO] : I/GeofenceModule BroadcastReceiver: (main) [27,63284] onReceive - OnRebootBroadcastReceiver for Geofence : android.location.MODE_CHANGED [INFO] : I/GeofenceModule BroadcastReceiver: (main) [1,63285] MODE_CHANGED [ERROR] : E/GeofenceModule BroadcastReceiver: (main) [1,63286] java.lang.IllegalArgumentException: Receiver not registered: ti.android.geofence.OnRebootBroadcastReceiver@982e6de [INFO] : I/GeofenceModule BroadcastReceiver: (main) [5,63291] updateGeofencesAdded() [INFO] : I/GeofenceModule BroadcastReceiver: (main) [0,63291] Added Geofences Successfully! It should be working...

deckameron commented 5 years ago

Thank you @powysm! I will investigate it asap.

powysm commented 5 years ago

Thanks, Let me know if i can give more information.

As an aside, I am also having an issue with the service. I have added as you have suggested and am just outputting the id of the fences encountered:

Ti.API.info('IT WORKED! It is a service');

var geofence = require("ti.android.geofence");

var geoTriggers = geofence.getLastestFiredGeofenceTransitionData();

if(geoTriggers.fences) {

var gLength = geoTriggers.fences.length;

for (var i=0; i < gLength; i++) {

    if(geoTriggers.event == geofence.ENTERED){

        Ti.API.info('geofence service : ENTERED '+

geoTriggers.fences[i].id);

    }

    else if(geoTriggers.event == geofence.EXITED){

    Ti.API.info('geofence service : EXIT '+ geoTriggers.fences[i].id);

    }

};

} else {

Titanium.API.warn("No fences for this event!");

};

However soon after it traces out after entering event is received the app crashes, if i remove the service again its fine.

console looks like:

[INFO] : JavascriptService: In Service Listener

[INFO] : JavascriptService: Full Service Name: uk.co.moilin.mobiguide.cafc.sfc.AndroidGeofenceService

[INFO] : GeofenceTransitionsIS: Firing ENTERED...

[INFO] : JavascriptService: Service Started

[INFO] : GeofenceModule: (AsyncTask #1) [5261,20196] Firing ENTERED event...

[WARN] : GeofenceModule: (AsyncTask #1) [0,20196] NOTIFICATIONS ARE DESISABLED FOR THIS FENCE!

[WARN] : TiJSIntervalService: (main) [16,20212] The intent is missing the extra value 'interval', therefore the code will be executed only once.

[INFO] : IT WORKED! It is a service

[INFO] : geofence service : ENTERED office

[INFO] : GEOFENCE ENTERED

[INFO] : {"type":"ENTERED","source":{"apiName":"Ti.Module","bubbleParent":true,"invocationAPIs":[],"_events":{"ERROR":{},"ENTERED":{},"EXITED":{},"DWELL":{},"STARTED_MONITORING":{},"undefined":{},"GEOFENCES_ADDED":{},"NOTIFICATION_CLICKED":{}}},"data":{"fences":{"alert":"I am at office address now.","licon":" http://framework.sparklogix.com/wp-content/uploads/2016/01/globe1.png","custom":[{"latitude":"51.664720","id":"office","longitude":"-4.070620"}],"bgac":"#00AEE6","sicon":"push","ledc":"#FF009688","id":"office","canNotify":false,"title":"Office Address","event":"ENTERED","bicon":" https://maps.googleapis.com/maps/api/streetview?size=512x256&location=51.66472,-4.07062&fov=120&pitch=0 "}},"bubbles":false,"success":true,"code":0,"cancelBubble":false}

[INFO] : regionObj: [object Object]

[ERROR] : NotificationManager: notifyAsUser: tag=null, id=1, user=UserHandle{0}

[INFO] : zygote64: Thread[3,tid=5299,WaitingInMainSignalCatcherLoop,Thread*=0x7bc025ca00,peer=0x19a408a0,"Signal Catcher"]: reacting to signal 3

[INFO] : zygote64:

[WARN] : libEGL: EGLNativeWindowType 0x7b95779010 disconnect failed

[INFO] : zygote64: Wrote stack traces to '/data/anr/traces.txt'

[INFO] : Error: passive is unavailable

[INFO] : Error: network is unavailable

[WARN] : libEGL: EGLNativeWindowType 0x7b97ece010 disconnect failed

[ERROR] : TiExceptionHandler: (main) [9051,29263] Context.startForegroundService() did not then call Service.startForeground()

[ERROR] : TiExceptionHandler:

[ERROR] : TiExceptionHandler: android.app.ActivityThread$H.handleMessage(ActivityThread.java:2204)

[ERROR] : TiExceptionHandler: android.os.Handler.dispatchMessage(Handler.java:108)

[ERROR] : TiExceptionHandler: android.os.Looper.loop(Looper.java:166)

[ERROR] : TiExceptionHandler: android.app.ActivityThread.main(ActivityThread.java:7529)

[ERROR] : TiExceptionHandler: java.lang.reflect.Method.invoke(Native Method)

[ERROR] : TiExceptionHandler: com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:245)

[ERROR] : TiExceptionHandler: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:921)

[WARN] : W/System.err: Exit due to uncaughtException in main thread:

[INFO] : zygote64: System.exit called, status: 10

[INFO] : AndroidRuntime: VM exiting with result code 10, cleanup skipped.

This is being tested on my android 8.0.0 device . Working against SDK 8.0.0.

Should i create another issue for this?

Many thanks

Mathew

On Fri, May 10, 2019 at 3:15 PM Douglas Alves notifications@github.com wrote:

Thank you @powysm https://github.com/powysm! I will investigate it asap.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/deckameron/Ti.Android.Geofence/issues/7#issuecomment-491304392, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVJEHJ6CCUL4HIM5DRPUHLPUV7P3ANCNFSM4HMC3TJA .

-- Mathew Powell Freelance Developer matpowell@gmail.com https://uk.linkedin.com/pub/mathew-powell/b3/8b7/404

deckameron commented 5 years ago

Hi @powysm I have created a new issue regarding the second message. It is a known android>=26 issue and I don't know how to solve it.

About this issue. It is directly related to the this one and it is because of the implicit broadcast ban on android>=26. I have fallowed every suggestion on Google fix thread and stackoverflow without success.

I need to invest more time in it.