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

Blank tiles #20

Closed
uyt95 opened this issue Jan 22, 2021 · 4 comments
Closed

Blank tiles #20

uyt95 opened this issue Jan 22, 2021 · 4 comments

Comments

@uyt95
Copy link

uyt95 commented Jan 22, 2021

Hi

I'm having issues with a number of blank tiles. Sometimes when zooming those tiles get filled in at specific zoom ranges, but most of the time they are blank.
Depending on the map the number of blank tiles ranges between 0 and +-30. For a specific map, the number of blank tiles and the location of the blank tiles are consistent across app restarts.
I'm only using a level count of 1 and no errors are thrown while loading the map and the tiles.

Do you have any idea what could be the cause of this?

Thanks in advance!

@p-lr
Copy link
Owner

p-lr commented Jan 23, 2021

Hi,

I tried to reproduce it locally, in a demo with a single level. No blank tiles.
Which version of MapView are you using?

@uyt95
Copy link
Author

uyt95 commented Jan 23, 2021

Hi, at first I was using version 2.1.3. I upgraded to 2.1.4 and the issue remains.
I've created a demo that always reproduces the issue for me with a lot of blank tiles:
https://github.com/uyt95/BlankTilesDemo

@p-lr
Copy link
Owner

p-lr commented Jan 23, 2021

I've tried your demo on my device and on two emulators, and I never saw a blank tile. Nice map BTW.
This is really surprising. Have you reproduced your issue on other devices?

Also, I have a remark about your TileStreamProvider:

TileStreamProvider { row, col, _ ->
   try {
      application.assets.open("tiles/${col}x${row}.jpg")
   } catch (e: Exception) {
      null
   }
}

If on your device, there's something wrong when reading a tile file from the assets, you silently catch the exception.
You should add e.printStackTrace() before returning null. You might see some exceptions in logcat. This might come from permission issues.

@uyt95
Copy link
Author

uyt95 commented Jan 24, 2021

I wasn't able to reproduce it on other devices, but I found the cause.
Xiaomi devices have a bad forced dark mode implementation that sometimes overwrites tiles with a blank tile. To fix this, I added the following to my application style: <item name="android:forceDarkAllowed">false</item>

Thanks for your help!

@uyt95 uyt95 closed this as completed Jan 24, 2021
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

2 participants