Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
techker
Channel Surfer

Roku Variants like Android?

Hello, is it possible to have product variants setup like android for Roku?

Since we have 1 app that has multiple brands (variants)

in android we select the flavor and it builds according to this.

All images, logos, strings are attached to the flavor(Variant)

Would this be possible?Because currently on each build we ned to replace all the information to relate to the brand we need.

Like Brand A has all images, text associated.

if we want Brand B we need to replace all of that and then build.

Thx

0 Kudos
7 REPLIES 7
necrotek
Roku Guru

Re: Roku Variants like Android?

This is possible with VScode. Not as simple as adding flavors to gradle. You can set up multiple projects with the app specific code and in the launch.json include a folder with all your shared code.

JulianToro
Reel Rookie

Re: Roku Variants like Android?

An option could be storing in cloud an object (Json) with the settings for the current app, such as texts, urls for pictures, and configurations. The idea is to set a different end point for each one, or to have a bigger object with the settings for all variations. Then, you could set via manifest, the brand that your are pointing out, and by the use of urls like "http://repository.com/mybrandsconfig/{brandName}/home.title.for.first.tray" you could replace this previous set brand name to access your configs

0 Kudos
techker
Channel Surfer

Re: Roku Variants like Android?

hmm true, my goal was to automate the builds..

 

Like android i select assembleBrandADebug....and it nuilds that brand

there has to be a way to have multiple sub directories that have the images and icons..

 

so we select a manifiest and it loads that information.

0 Kudos
JulianToro
Reel Rookie

Re: Roku Variants like Android?

Are the images and icons in the build? You can use the path as same as mentioned before.

For building build automatically, you can use a bash script. It could edit the manifest file with the brand name and select the desired folder to attach into the build. Then zip the file.

We use bash scripts for "customizing" builds for QA. We have different parameters to control the apps behavior (such as connecting to stage APIs, running with proxy, and so on). QA team uses a bash script for changing the app builds they receive, without needing to unzip, edit manifest file, and zip again.

I'm looking about assembleBrandDebug to a better understanding of what are you trying to do, but it seems similar to the ones that I'm telling you. If you need help with the script, I can give you and example 😉

0 Kudos
techker
Channel Surfer

Re: Roku Variants like Android?

ah, that is maybe the solution. we use azure devops. i can add bash. would be great to see the example.

 

really appreciate the help👍

0 Kudos
JulianToro
Reel Rookie

Re: Roku Variants like Android?

Sure!

You must add a new property in the manifest file:
brand_build=brand_name

Your script file could be:
brand_variants.sh
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

replace_config_value brand_build $1 manifest

replace_config_value () {
    key=$1
    val=$2
    file=$3

    if [[ -z "$key" || -z "$val" ]];then
       echo "No valid key or value"
       return
    fi

    echo " >> Setting: $key = $val"; \

    if [ "$(uname)" == "Darwin" ];then
       sed -i '.bak' "s/^\($key=*\).*/\1$val/" $file
       rm $file.bak
    elif [ "$(uname)" == "Linux" ];then
       sed -i -e "s/^\($key=*\).*/\1$val/" $file
    else
       sed -i -e "s/^\($key=*\).*/\1$val/" $file
    fi
}
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -

It runs at follows:
./brand_variants.sh brand_name

You can get the brand's name with:
appInfo = CreateObject("roAppInfo")
brandName = appInfo
.GetValue("brand_build")

And replace your paths as follows:
brandLogo = CreateObject("roSGNode", "Poster")
brandLogo.uri = Substitute("pkg:/images/{0}/brand_logo.png", brandName)
techker
Channel Surfer

Re: Roku Variants like Android?

cool, i will try it out!thx!

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.