warren-bank / Android-SMS-Automatic-Reply-GPS

Android app that listens for incoming SMS text/data messages and conditionally sends an automatic reply containing GPS location data.
GNU General Public License v2.0
68 stars 13 forks source link

"app stopped working" after receiving sms #1

Closed danielllek closed 4 years ago

danielllek commented 4 years ago

After I receive sms from whitelisted number, telephone gets GPS fix, and than I get message "SMS my GPS stopped working". Return sms with location is not sent. Android 7.1.1 (xperia z5 compact).

Any ideas what can be wrong?

danielllek commented 4 years ago

Connected logcat to my phone:

2020-05-01 21:02:19.405 22895-22895/com.github.warren_bank.sms_automatic_reply_gps I/SMSReceiver: SMS received.
    from: +48.....
    message: .......
2020-05-01 21:02:57.737 22895-22895/com.github.warren_bank.sms_automatic_reply_gps D/AndroidRuntime: Shutting down VM
2020-05-01 21:02:57.738 22895-22895/com.github.warren_bank.sms_automatic_reply_gps E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.github.warren_bank.sms_automatic_reply_gps, PID: 22895
    java.lang.NoSuchMethodError: No virtual method getBearingAccuracyDegrees()F in class Landroid/location/Location; or its super classes (declaration of 'android.location.Location' appears in /system/framework/framework.jar)
        at com.github.warren_bank.sms_automatic_reply_gps.event.GPSSender$SMSLocationListener.getDirection(GPSSender.java:107)
        at com.github.warren_bank.sms_automatic_reply_gps.event.GPSSender$SMSLocationListener.onLocationChanged(GPSSender.java:47)
        at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:297)
        at android.location.LocationManager$ListenerTransport.-wrap0(LocationManager.java)
        at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:242)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:241)
        at android.app.ActivityThread.main(ActivityThread.java:6274)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
warren-bank commented 4 years ago

nice catch! ..I don't know how I messed up this statement by checking for the wrong SDK version (ie: 23 instead of [26](https://developer.android.com/reference/android/location/Location#getBearingAccuracyDegrees())):

  float accuracy = (Build.VERSION.SDK_INT >= 23)
    ? location.getBearingAccuracyDegrees()
    : Float.MIN_VALUE;

..I'll push an update shortly. Thanks for letting me know :)

danielllek commented 4 years ago

Found it few minutes ago too :-D Works with the fix.

warren-bank commented 4 years ago

Whew!.. glad to hear it :) Again, sorry for the bug.. that was totally my bad.

danielllek commented 4 years ago

I can post PR if you like.

warren-bank commented 4 years ago

not necessary.. it's literally a 1 character fix :P

..I'm in the middle of doing something else atm, but I'll definitely post this before tomorrow

warren-bank commented 4 years ago

just released the apk for v2.1.6

thanks again for finding this bug.. much appreciated!