android - Features Enabled For Our Beta Testers, Release How to Remove -


we have menu on activity allows beta users switch between several testing/staging database/rest servers. on release remove menu being seen. don't want variable in code have modify hand. want our ci me. not sure best way dynamically build remove this. thinking of adding debuggable in manifest, , when jenkins builds release changes manifest debuggable false in turn code hide menu users. best way or there better way? (maybe use testonly in manifest?)

currently using debuggable attribute in manifest not set in file since eclipse frowns on this. in ant script have created custom_rules.xml set property in manifest manually based on targets false if release , true if debug version.

<target name="-set-debug-files" depends="-set-mode-check"> .....     <!-- alter app manifest reflect testing state -->     <property name="match.start" value="android:debuggable="/>     <property name="match.end" value=">"/>     <replaceregexp file="androidmanifest.xml"                match="${match.start}.*${match.end}"                replace="${match.start}&quot;true&quot;${match.end}">     </replaceregexp>      <echo level="info">${ant.project.name}          setting manifest debug state true</echo> </target>  <target name="-set-release-mode" depends="-set-mode-check"> ......     <property name="match.start" value="android:debuggable="/>     <property name="match.end" value=">"/>     <replaceregexp file="androidmanifest.xml"                match="${match.start}.*${match.end}"                replace="${match.start}&quot;false&quot;${match.end}">     </replaceregexp>      <echo level="info">${ant.project.name}           setting manifest debug state false</echo>  </target> 

then in code placed in custom application class created static can reference in activities.

debug = (getapplicationinfo().flags & applicationinfo.flag_debuggable) != 0; 

then when need hide/show stuff use:

if (myapplication.debuggable) {     ...show stuff } else {     ...hide stuff } 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -