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

No location provided (how to debug) #50

Open
AllesMeins opened this issue Oct 7, 2019 · 24 comments
Open

No location provided (how to debug) #50

AllesMeins opened this issue Oct 7, 2019 · 24 comments

Comments

@AllesMeins
Copy link

Unfortunately I can't get the location backend to work and I'm a bit lost to find the reason. I've installed the latest UnifiedNlp (GAPPS Version, since I've playstore installed), the XposedUnifiedNlp Module and the IchnaeaNlpBackend 1.4.0 configured and activated. According to the SelfTest everything is in order and should work but "No UnifiedNlp location was provided by the system within 10 seconds".

Now I'm a bit lost on how to find the problem. There is no error message and logcat doesn't show any related errors. Are there any other ways to debug this problem? Or is this a known behaviour?

Im using Lineage 16.0 on an Sony Xperia XZ1Compact

@baldrianbandit
Copy link

baldrianbandit commented Oct 7, 2019

I'm running Lineage 16 w/o Gapps on a XZ1C.

There is a known bug that makes IchnaeaNlpBackend find no cells, see [https://github.com//issues/38](this issue). With wifi disabled and with an app in foreground that queries network location, i.e. SatStat
adb logcat | grep Ichnaea
results in
IchnaeaBackendService: Cells: 0

The backend does resolve location by wifi, though. With wifi enabled, you should get IchnaeaBackendService: request: {"wifiAccessPoints":[<wifi access points around you>])
IchnaeaBackendService: response: {"location": {"lat": <lat>, "lng": <lng>}, "accuracy": <acc>}

@AllesMeins
Copy link
Author

Thanks for the reply, but this doesn't seem to be the problem. I checked the log and there are access points around me in there and even my accurate location. But somehow this location does get lost somewhere along the way. I've added two logs - one is filtered by "nlp" and the other one by "Ichnaea". In both I removed my location and replaced it with XX,XXXXXX and YY,YYYYYY
logcat_nlp.txt
logcat_Ichnaea.txt

@domkrm
Copy link

domkrm commented Oct 27, 2019

I have the same problem and after some analysing, testing and searching I found the following issue tracker entry: https://issuetracker.google.com/issues/113560852
It seems that this is a bug since Android 9 in combination with 0-prefixed MNCs (e.g. "01").
The last comment is "The issue has been fixed and it will become be available in a future Android release". I looked into the Android 10 source code and the bug still exists.

@Iey4iej3
Copy link

Iey4iej3 commented Oct 29, 2019

I have the same problem and after some analysing, testing and searching I found the following issue tracker entry: https://issuetracker.google.com/issues/113560852
It seems that this is a bug since Android 9 in combination with 0-prefixed MNCs (e.g. "01").
The last comment is "The issue has been fixed and it will become be available in a future Android release". I looked into the Android 10 source code and the bug still exists.

This seems to be fixed upstream but not fixed in the source code of LineageOS 17 where I have just committed.

@domkrm
Copy link

domkrm commented Oct 29, 2019

This seems to be fixed upstream but not fixed in the source code of LineageOS 17 where I have just committed.

Yes, I see this too. But I don't think this is fixed correctly. It's still checked if length of MNC is between 2 and 3.

private static final int MNC_MIN_LENGTH = 2;
private static final int MNC_MAX_LENGTH = 3;

if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;

I know that MNC must be 2- or 3-digits. But since the MNC is passed as INT to the constructors of the subclasses the 0-prefixed MNCs will be translated into 1-digit MNCs.

public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
    this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc),
            String.valueOf(mnc), null, null);
}

@Iey4iej3
Copy link

Iey4iej3 commented Oct 29, 2019

This seems to be fixed upstream but not fixed in the source code of LineageOS 17 where I have just committed.

Yes, I see this too. But I don't think this is fixed correctly. It's still checked if length of MNC is between 2 and 3.

private static final int MNC_MIN_LENGTH = 2;
private static final int MNC_MAX_LENGTH = 3;

if (mnc.length() < MNC_MIN_LENGTH || mnc.length() > MNC_MAX_LENGTH) return false;

I know that MNC must be 2- or 3-digits. But since the MNC is passed as INT to the constructors of the subclasses the 0-prefixed MNCs will be translated into 1-digit MNCs.

public CellIdentityLte(int mcc, int mnc, int ci, int pci, int tac) {
    this(ci, pci, tac, CellInfo.UNAVAILABLE, CellInfo.UNAVAILABLE, String.valueOf(mcc),
            String.valueOf(mnc), null, null);
}

Maybe you need to add a comment there. By the way, I don't know what @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) means (the line preceding the construction method that you have quoted).

You can also commit at the LOS repo.

@domkrm
Copy link

domkrm commented Nov 1, 2019

Maybe you need to add a comment there. By the way, I don't know what @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) means (the line preceding the construction method that you have quoted).

You can also commit at the LOS repo.

Sorry, I overlooked the second constructor in the subclasses.

public CellIdentityLte(int ci, int pci, int tac, int earfcn, int bandwidth, String mccStr,
        String mncStr, String alphal, String alphas) {
    super(TAG, CellInfo.TYPE_LTE, mccStr, mncStr, alphal, alphas);
...
}

Here the MNC is passed as STRING to the constructor.

But I don't get it where these constructors get called.

@UnsupportedAppUsage means that App developers shouldn't rely on the following method, because it's only for internal use and could be changed anytime.

@Iey4iej3
Copy link

Iey4iej3 commented Nov 2, 2019

There seems a lot of constructors. By the way, do you know how often these codes are merged into LOS repo?

@domkrm
Copy link

domkrm commented Nov 9, 2019

There seems a lot of constructors. By the way, do you know how often these codes are merged into LOS repo?

No, sorry. It's the first time I deal with the Android/LOS internal source code.

@kurt-by
Copy link

kurt-by commented Dec 15, 2019

I have the same problem and after some analysing, testing and searching I found the following issue tracker entry: https://issuetracker.google.com/issues/113560852
It seems that this is a bug since Android 9 in combination with 0-prefixed MNCs (e.g. "01").
The last comment is "The issue has been fixed and it will become be available in a future Android release". I looked into the Android 10 source code and the bug still exists.

This seems to be fixed upstream but not fixed in the source code of LineageOS 17 where I have just committed.

Sorry, that's not how pull requests for LineageOS are done. They have ther code review in https://review.lineageos.org/q/status:open

@anonimno1
Copy link

Hi people,
anything new concerning this bug?
I am on LineageOS 16 for uG and none of the NLP backends (Mozilla, DejaVu) work with cell identification.
Due to the fact that this seems to be an Andoroid 9 bug switching to another ROM will not get this working, right?
Regards
K

@baldrianbandit
Copy link

Hi people,
Regards
K

Switching to microG and it's shipped UnifiedNlp can do the trick, at least when using LocalGSM network provider.
Refer to this post in the Sony XZ1C LineageOS thread.

@domkrm
Copy link

domkrm commented Jan 9, 2020

Hi people,
Regards
K

Switching to microG and it's shipped UnifiedNlp can do the trick, at least when using LocalGSM network provider.
Refer to this post in the Sony XZ1C LineageOS thread.

LocalGSM provider should always work.
I take a look in the source code.
If it can't get a valid cell information then another approach is used to get a valid cell information.

@domkrm
Copy link

domkrm commented Jan 9, 2020

Hi people,
anything new concerning this bug?
I am on LineageOS 16 for uG and none of the NLP backends (Mozilla, DejaVu) work with cell identification.
Due to the fact that this seems to be an Andoroid 9 bug switching to another ROM will not get this working, right?
Regards
K

I made a pull request in the UnifiedNlpApi (microg/android_external_UnifiedNlpApi#10) which has a workaround for the bug in Android 9.
It's already merged but I have to wait for @mar-v-in to make a new release.
Then we can update the backends which uses the Api.
And then a new release in the F-Droid is needed.

If you want you can install the attached APK.
It's the Mozilla Location Service with my fix included.
You must activate this backend in the microG settings (name is "Mozilla Location Service 2").

For me this fixed the problem and I successfully get a network location.

If you have tested it, please tell me if it workes for you also.

org.microg.nlp.backend.ichnaea2.apk.zip

@baldrianbandit
Copy link

baldrianbandit commented Jan 10, 2020

Thank you. org.microg.nlp.backend.ichnaea2 keeps crashing on my LineageOS 16 device using com.google.android.gms (microG Service Core 0.210.19420) and it's built in UnifiedNlp. I'm going to test it on org.microg.nlp (a.k.a UnifedNlp 1.6.8).

Update:
Crashes also when used together with org.microg.nlp.
log.txt

@anonimno1
Copy link

Hi people,
Regards
K

Switching to microG and it's shipped UnifiedNlp can do the trick, at least when using LocalGSM network provider.
Refer to this post in the Sony XZ1C LineageOS thread.

LocalGSM provider should always work.
I take a look in the source code.
If it can't get a valid cell information then another approach is used to get a valid cell information.

LocalGSM works, I confirmed this today.
This is interesting, because DejaVu does not work with cell information, although it is the same developer as LocalGSM.

@anonimno1
Copy link

Thank you. org.microg.nlp.backend.ichnaea2 keeps crashing on my LineageOS 16 device using com.google.android.gms (microG Service Core 0.210.19420) and it's built in UnifiedNlp. I'm going to test it on org.microg.nlp (a.k.a UnifedNlp 1.6.8).

It crashes on my LOS 16 also.
Today I wiped the LOSforuG and installed pure LOS.
Will also test if UnifiedNlp from F-Droid works.

@domkrm
Copy link

domkrm commented Jan 10, 2020

Thank you. org.microg.nlp.backend.ichnaea2 keeps crashing on my LineageOS 16 device using com.google.android.gms (microG Service Core 0.210.19420) and it's built in UnifiedNlp. I'm going to test it on org.microg.nlp (a.k.a UnifedNlp 1.6.8).

Update:
Crashes also when used together with org.microg.nlp.
log.txt

Could you please go into app settings of my app and give it the two permissions. They should be deactivated. After activation it should work without crashes.

@baldrianbandit
Copy link

Could you please go into app settings of my app and give it the two permissions. They should be deactivated. After activation it should work without crashes.

Both permissions disabled and enabled (and repeated several times), also deleted /data/user/0/org.microg.nlp.backend.ichnaea2 and rebooted several times, but no luck.

@domkrm
Copy link

domkrm commented Jan 14, 2020

Could you please go into app settings of my app and give it the two permissions. They should be deactivated. After activation it should work without crashes.

Both permissions disabled and enabled (and repeated several times), also deleted /data/user/0/org.microg.nlp.backend.ichnaea2 and rebooted several times, but no luck.

Could you please retry it with the following APK?
I think I uploaded an old APK first.

org.microg.nlp.backend.ichnaea2.apk.zip

@kurt-by
Copy link

kurt-by commented Jan 14, 2020

Could you please go into app settings of my app and give it the two permissions. They should be deactivated. After activation it should work without crashes.

Both permissions disabled and enabled (and repeated several times), also deleted /data/user/0/org.microg.nlp.backend.ichnaea2 and rebooted several times, but no luck.

Could you please retry it with the following APK?
I think I uploaded an old APK first.

org.microg.nlp.backend.ichnaea2.apk.zip

Sorry, does work on first try on superiorOS android 10 bacon. But stops to work after some time.

@baldrianbandit
Copy link

baldrianbandit commented Jan 15, 2020

Could you please retry it with the following APK?

Works quite well. Repeated screen unlock / open SatStat / get network location fix / close SatStat / lock screen several times. Acquiring a location fix usually takes 5 to 20 seconds and grays out after some seconds, but that's fine. Log messages look good.

Edit: Sony G4881 (XZ1C) with LineageOS 16

@kurt-by
Copy link

kurt-by commented Jan 15, 2020

Could you please retry it with the following APK?

Works quite well. Repeated screen unlock / open SatStat / get network location fix / close SatStat / lock screen several times. Acquiring a location fix usually takes 5 to 20 seconds and grays out after some seconds, but that's fine. Log messages look good.

What phone/ROM?

@y0va
Copy link

y0va commented Nov 3, 2021

Yay, first time I got Ichnaea to work. Could you please provide a pull request or diff for that?

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

7 participants