Android Question Test App for Android TV

microbox

Active Member
Licensed User
Longtime User
Hello everyone, I'm planning to create a simple app for Android TV. I don't have the TV yet but I want to ask here first before buying and please do share your experiences. Any input are much appreciated.

Kind regards,
microbox
 

luisftv

Member
Licensed User
Longtime User
NJDude,

How did you manage to show Android TV (like on the Sony Android 4K TVs) home screen shortcuts/icons?

I cannot find any B4A code sample or instructions.

After installing my apps, they will show only when using a file manager, but the home screen Icon does not show. As I understand, the shortcuts are made of two images, perhaps it even has to have it's own activity in the code...

Please help.
 
Upvote 0

luisftv

Member
Licensed User
Longtime User
Thank you for replying NJDude.

I tried following the instructions (and here) on Google... but, unfortunately, I do not speak Java. I cannot do the conversion to the B4A language. Also, there are some libraries that only exist on Java for the "Leanback" theme which the TVs use...

I've made the banner, but the activity code in Google is for Java, bringing it to B4A without conversion/translation issues errors.

Please accept my apologies, but I'm new to programming...
 
Last edited:
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Check the attached sample, pay attention to the Manifest entries.

You also need to create a "banner" (you will find that in the "\Objects\res\drawable" directory, it has to be that specific size and set as read only).
 

Attachments

  • AndroidTV_Barebones_Sample.zip
    12.3 KB · Views: 868
Upvote 0

luisftv

Member
Licensed User
Longtime User
I tried compiling/running your sample but I get an error. See attached image.

I might have a library or something missing but I don't know what?

I see that your banner.png file is in the res folder, so it's not your code that is missing anything... it's my side here, but what?

Any ideas?

Thank you. So far, you been the most helpful on this topic.

AndroidTVSample_Banner_error.png
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Run the original sample in release mode and without modifications, it should work, I see you are obfuscating the code.

Even with obfuscation it should work, check your code, if you have changed the banner make sure is read only.
 
Upvote 0

luisftv

Member
Licensed User
Longtime User
Here is what I did:

1. Extracted your sample for the zip file
2. Immediately opened it with B4A
3. Immediately Run it... and I get the error message

I didn't change a thing...

I went into the drawable folder and I checked the properties of the banner and it is still "read-only". I change to "Release" mode now:

AndroidTVSample_Banner_error2.png
 
Upvote 0

luisftv

Member
Licensed User
Longtime User
I am absolutely sure that I am missing something... I am absolutely confident hat it is not you code sir. I just would love to know what I am missing...

I found this, but it is all gibberish to me.
 
Upvote 0

luisftv

Member
Licensed User
Longtime User
I retyped the line... same result.


By the way, I just installed the apk file you gave me onto my Sony 4K Android TV and it works flawlessly...

That proves it is not your code/sample.

It is something I am missing in my setup of B4A...

AndroidTVSample_Banner_working.png
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Well, don't know what to say, I even downloaded the sample I posted and it works. You are not missing anything, as you can see that code is super simple and I wrote that example from scratch.
 
Upvote 0

luisftv

Member
Licensed User
Longtime User
The solution was:

1. In the B4A main window, go to "Tool", then "Configure Paths"
2. In the section "android.jar" (depending on where you installed it, but here is where I have it) make sure you change the android.jar version to 22 or newer if available:

C:\Program Files (x86)\Android\android-sdk\platforms\android-22\android.jar

I originally had version 17: C:\Program Files (x86)\Android\android-sdk\platforms\android-17\android.jar and as you know, it was old and had no support for Android TVs.

I knew it had to be on my side, the error that is.

Thank you. Thank you. Thank you. Thank you.

I hope you also get what I sent you... through the other channel...

Thank you again.
 
Last edited:
Upvote 0
Top