phyphox/phyphox-android

Crash in gps section

Closed this issue · 9 comments

Hello,

I can't use the gps section. When i click on «play» in the said section, the app crash.

Sorry for the trouble and thanks for reporting this.

Unfortunately, I could not yet find a crash report that matches your description. Could you please add a few more details, like the app version and your phone model? The easiest way, is to tap the "i" in the top-right corner of the main menu, select "Device info" and then "Copy to clipboard". You can then simply paste the info here.

I have the same problem. The GPS on my device seems to be defect in general, but imho the app should not crash in that case. I will try to upload a crash report as soon as possible, but right now I am at the 36c3 and there is so much to do.

Thanks and too bad I haven't looked into my mail for a few days - we could have met at the 36c3 and quickly get a crash report. I found a candidate for the crash (haven't looked into the details though). Could you also tell me which device you are using to confirm that I am looking at the right report?

I have a google nexus with lineage OS. When I monitored the app, with adb, I got the following exception:
** ERROR: PROCESS CRASHED processName: de.rwth_aachen.phyphox processPid: 26671 shortMsg: java.lang.IllegalArgumentException longMsg: java.lang.IllegalArgumentException: provider doesn't exist: network timeMillis: 1578056212006 stack: java.lang.IllegalArgumentException: provider doesn't exist: network at android.os.Parcel.readException(Parcel.java:1696) at android.os.Parcel.readException(Parcel.java:1645) at android.location.ILocationManager$Stub$Proxy.requestLocationUpdates(ILocationManager.java:614) at android.location.LocationManager.requestLocationUpdates(LocationManager.java:899) at android.location.LocationManager.requestLocationUpdates(LocationManager.java:472) at de.rwth_aachen.phyphox.GpsInput.start(GpsInput.java:101) at de.rwth_aachen.phyphox.phyphoxExperiment.startAllIO(phyphoxExperiment.java:418) at de.rwth_aachen.phyphox.Experiment.startMeasurement(Experiment.java:1361) at de.rwth_aachen.phyphox.Experiment.onClick(Experiment.java:784) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22433) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6186) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

Perfect, that makes a lot of sense. No idea why your device does not have a network location provider, but indeed phyphox should not crash. This should be an easy fix for the next version (although I cannot test it) and it might even work if we only use the GPS location provider.

(After all, we only request the network provide on top to avoid complaints from users who do not know the difference between GPS and network-based location and who would complain if Google Maps gives them a rough location in their basement while phyphox cannot get a GPS fix.)

Great! When the new version is published, I will test it and report if the problem is fixed.

The problem also occured on my LineageOS phone with no network provider.
The following changes in GpsInput.java, start()-method solved the problem for me:

//Start the data aquisition by registering a listener for this location manager.
public void start() {
    this.t0 = 0; //Reset t0. This will be set by the first sensor event
    lastSatBasedLocation = -100.0; //We did not yet have a GNSS-based location
    // Check for location providers and call only existing location providers
    // get GPS provider status
    boolean checkGPS = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
    // get network provider status
    boolean checkNetwork = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

    try {
        if (checkNetwork && !checkGPS)
            locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
        if (checkGPS)
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
        } catch (SecurityException e) {
            Log.e("gps start", "Security exception when requesting location updates: " + e.getMessage());
    }
    onStatusUpdate(0);
}

Thanks. I will implement a similar variant to be published in a few days. Phyphox by default uses both, the network and the GPS provider (mostly to avoid bad reviews from user who try the app in their basement) and you can switch to pure GPS from the menu. That's why there was the "forceGNSS" boolean was in there, which your code is now missing.

(Sorry, this update with minor fixes is being delayed for months now. Did not get around to much coding and there was always a little thing that was supposed to go into this update as well. It will hit the App Stores in a few days.)

Forgot to mention here. This should have been fixed with the latest update.