Android Question Test App for Android TV

Discussion in 'Android Questions' started by microbox, Jan 30, 2015.

  1. microbox

    microbox Active Member Licensed 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,
  2. NJDude

    NJDude Expert Licensed User

    A have a few apps compatible with AndroidTV, it is a simple process.
  3. microbox

    microbox Active Member Licensed User

    @NJDude - thanks for the reply. I think will go ahead try it then.
  4. supriono

    supriono Member Licensed User

    hello NJDude do you have same tutorial make library my be simple library...
  5. luisftv

    luisftv Member Licensed User


    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.
  6. NJDude

    NJDude Expert Licensed User

    Yes, have you followed the instructions on Google's site?, have you created the TV activity and the banner?
  7. luisftv

    luisftv Member Licensed 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: Jul 19, 2015
  8. NJDude

    NJDude Expert Licensed 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).

    Attached Files:

  9. luisftv

    luisftv Member Licensed 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.

  10. NJDude

    NJDude Expert Licensed 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.
  11. luisftv

    luisftv Member Licensed 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:

  12. NJDude

    NJDude Expert Licensed User

    Well, it works on my end, no issues.

    The attached APK is proof that it compiles and works.

    Attached Files:

    luisftv likes this.
  13. luisftv

    luisftv Member Licensed 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.
  14. NJDude

    NJDude Expert Licensed User

    Just as a goof, retype the line where the banner is defined in the manifest, in case there's a hidden character or something.
  15. luisftv

    luisftv Member Licensed 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...

  16. NJDude

    NJDude Expert Licensed 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.
  17. luisftv

    luisftv Member Licensed User

    Found the problem... I'll post the solution in a few minutes... I just need to test it further.
  18. luisftv

    luisftv Member Licensed 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: Jul 28, 2015
    moster67, microbox and DonManfred like this.
  19. NJDude

    NJDude Expert Licensed User

    Ah ok, glad you sorted out.

    Regarding the SDK, you only need to install the most recent one and get rid of the rest.

    Thanks for the donation, I really appreciate it.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice