Weird Loading issue on Android. Any ideas?

Was adding some polish to the game (instead of adding high scores like I was supposed to) and ran into this weird loading issue. The phone I’m testing with is a Nexus 6. It does not appear to occur on my Galaxy Tab A tablet. Anyone know a way to resolve this?

I actually have a hard time seeing what is wrong. It looks as though it’s flashing a bit oddly while loading and when you click the Play button but it all happens so fast.

Yeah. That is the issue. Just started happening. Random flash when loading. I guess I should’ve used words in addition to the video. It is quick but looks bad :confused:

Hmm, ok, and you’re not seeing the same behaviour in a desktop or iOS build? Or on another Android device?

Not seeing it on my other android tablet or desktop. No iOS builds to check yet.

Hmm, ok, strange. Are you using a custom render script? Are you using some kind of transition/effect between the different screens? When did it start behaving like this?

Default render script. Not transition effect (Still using the code from the magic link tutorial for that). Started yesterday after I added the count in, the quest pop up, and the rules to the pause menu. Should’ve done checks in smaller chunks but I did all of those things at roughly the same time.

Hmm, ok, so it must be related to one of those changes then. Are you loading/unloading any collections?

I am loading my board collection, but I had always been doing that. I’ll back out of all the changes and add them back in one by one to check when I get home tonight.

Ok, let us know how it goes!

Looking through all my changes, it seems to be related to window.set_dim_mode. The first time it is called, regardless of when, causes it to flash black for a second. The first black screen (when I click the app icon) isn’t something I’m really worried about assuming I can just modify the Android Manifest to give it some sort of loading image.

What I was attempting to do is only dim the screen when the game was in play (not during the main menu, pause, or level complete screen). I added it during the init of the main collection and it still seems to cause the flash in a noticeable manner. I’m going to remove the code for now until I can figure out why.

Update:

I guess I have to check if the dimming mode before I use it.

Update2:

Even with checking the dimming mode, it still messes up on the Nexus 6

Last update:

After pulling out a few more devices, it seems to work fine on Andriod 6.whatever but not 7.0 or 4.4.4.

1 Like

No, there is no such concept as loading/splash images on Android. You need to start with a minimal main collection with a loading/splash image and proxy collection to your main menu/game.

Would you mind sharing some code related to how you work with the window.set_dim_mode() function?

1 Like

I don’t think I’m doing anything crazy with that function. What I want to do is

local function setDim(mode)
	if window.get_dim_mode() ~= window.DIMMING_UNKNOWN then
		window.set_dim_mode(mode)
	end
end

function on_message(self, message_id, message, sender)
        if message_id == hash("start_level") then
		msg.post("main:/main#boardproxy", "set_time_step", {factor = 1, mode = 1})
		hasCountedIn = false
		msg.post(".", "acquire_input_focus")	
		build_board(self)
		setDim(window.DIMMING_OFF)
		msg.post("progress#gui", "reset")
		msg.post("/boardcover#sprite", "disable")
		startGame(self, 3)
	elseif message_id == hash("level_completed") then
		-- turn off input
		msg.post(".", "release_input_focus")
		go.animate("#", "endDelay", go.PLAYBACK_ONCE_FORWARD, 1, go.EASING_LINEAR, 0.5, 0, function ()
			-- Show completion screen
			msg.post("level_complete#gui", "show")
			setDim(window.DIMMING_ON)
			clear_board(self)
		end)

(more unrelated code)

end

but the problem occurs even when I do something as simple as this

function init(self)
	if window.get_dim_mode() ~= window.DIMMING_UNKNOWN then
		window.set_dim_mode(window.DIMMING_ON)
	end
	msg.post("#", "to_main_menu")
	self.state = "MAIN_MENU"
end

@britzl Does this help?