I am developing a simple app which will run on AndroidTV to show images and videos in a business centre. The images and videos will be downloaded through an API and saved to local.
However, I have problem with the network.download event listener on AndroidTV. Everything runs smoothly on a phone but on TV it does not work. After tens of times building and uploading to Google Play, and then updating on the TV and testing, I found out that the problem is somewhere in network.download event listener. When I check if event.isError, it does not give any error. When I print out the event.phase, it shows the “ended” phase, however, if I try to print out a text inside the “ended” phase, it does not show.
In the below code, globalData.itr is used for writing what it holds to the screen as I can not see the TV logs. On the screen it should write “downloaded” but it writes “equest network event listener phase ended”
Any idea what should I look for the fix this problem?
local function networkListener( event ) globalData.itr = "request network event listener phase "..event.phase if ( event.isError ) then print( "Network error: " .. event.response ) elseif ( event.phase == "began" ) then print( "Progress Phase: began" ) elseif event.phase == "ended" then print ( "RESPONSE: File downloaded" ) globalData.itr = "downloaded" end end