How to maintain different versions of an Android app - android

I have a question I cant find an answer to anywhere. Suppose I have an app which basically has some content catering to a group of users. So I have the source code checked into some sort of an SVN , and I have an apk generated which I use as required on the tablet. Now I have a different set of users. The only thing that changes are logos in the app which are images in the drawable folder, language of the app and content within the app. Now how can I dynamically pick the right logo or language based on the user. Based on what I understand I have to build the source code again using the parameters required and generate another apk. Is there no way i can communicate with the apk as to who the user is and it can show the right logo.? Is there any method kind of like String_Resources.xml in the .Net world.

Handling Screen Sizes
http://developer.android.com/guide/practices/screens_support.html
Handling Localization
http://developer.android.com/guide/topics/resources/localization.html
These 2 resources should help. I'm not sure what you mean by 'pick the right logo or language based on the user." Users Device or Users Language??
The system language settings on the users device will determine which language folder to use (if you have them set up as outlined in the second link).
If you want select a logo based on screen size, see the first link. Basically you create identical xml layouts and put them into separate folders like:
layout-normal
layout-small
layout-large
layout-xlarge
then just change the drawable in the xml file for each screen size.

No, you need to generate new apk with new app package e.g.
myapplication.company1
myapplication.company2
...
myapplication.companyN
This topic may be helpful

Related

Android: Programmatically change SourceSet based on user settings

I am creating an app that has admin and user modes, and each mode has its own layouts, strings, and drawable resource files. I want to know how to change the resources SourceSet based on the app mode which can be toggled by the user at runtime.
Currently, I am using 2 product flavors to do this. But the problem with flavors is that it is build time, and I have to create 2 different apks, one for each flavor. So, being able to change SourceSet at runtime means I can have only 1 apk.
Update: I simply want a textview to call R.string.title, and this will call different string files based the user mode (Admin or user). This is the same as changing Locale language (en vs fr for example) will call the appropriate file without the need to change the code.
I want to know how to change the resources SourceSet based on the app mode which can be toggled by the user at runtime.
That is not possible. Source sets are a compile-time construct. An APK contains the contents of source sets based on the build variant you chose when you compiled the APK — the contents of other source sets are not in that APK.
I am creating an app that has admin and user modes, and each mode has its own layouts, strings, and drawable resource files.
Then either those are two apps (and two APKs), or you need to have all of those resources in the one source set that goes into your one APK.
Usually, an admin mode also involves dedicated Java/Kotlin code (e.g., dedicated fragments), and so just swapping resources would be insufficient, anyway.
If you are distributing solely through the Play Store, you could look into using dynamic feature modules, if your concern is the size of the APK with both user and admin code/resources in it.
The solution which worked for me in case there were corporate applications where default launcher was locked and user launched login screen by default there were two separate applications which were switched depends on the role of the user. In other app where one apk I just made different screens launches with its own logic based on role user choose.
But that also might help you Dynamically generating product flavors

How to organize image files of different sizes (devices) in a Appcelerator Titanium project

I have recently started creating an Android application using Appcelerator's Titanium.
Since in the application I requires to keep several images/icons with different sizes & dimensions essentially, So I need some advice on how I should organize them in the project.
And as you know like in Android project (Android studio or Eclipse with Android SDK) there is a predefined folder structure so if you want to keep any image then put them in all device sizes corresponding to the prescribed folders. So based on device sizes it will automatically detect corresponding dimension image from device preferable folder.
So does same approach can we achieve in Appcelerator's Titanium ?
Below is the default project structure for Appcelerator's Titanium project (5.1.2.GA)
As you can see there is 2 places where I can keep images. So can you suggest me where I can keep my images and how can I access them
Thanks, Any suggestion will be helpful for me. ~Chandan
Titanium supports platform, device and density specific images via folder and file conventions. I won't go into details here, but these two links walk you through:
How to use Device Specific Images
How to use Density Specific Images
The first part is used to be more specific about when these resources should be used. Images in sub-directories give us more control over when they are used.For example images that are in a folder named "res-long-land-hdpi" will be used for:
Long screens, such as WQVGA, WVGA, FWVGA
Device is in landscape orientation (horizontal)
High-density screens; approximately 240dpi.
Documentation Link
for me i deleted all folders in android/images (First) and i replaced them by folders in android/res (second)
like this

Android app support multiple languages

If I want to upload my Android app with an aim of supporting multiple languages, do I have to upload multiple .apks, each designed for the language I would like to support, or do I implement it all into one .apk file?
Note: My app is a game and does not really not contain any Strings in the UI. The UI was made using Photoshop, eg the buttons with text and so on.
If I pack all the languages into one .apk file, how do I check which language the app should use?
Update:
All my images are stored in the assets folder of my project. How would I localize them?
No, you don't need to create multiple APKs, just single APK with Localization, see this http://developer.android.com/training/basics/supporting-devices/languages.html
and this http://developer.android.com/guide/topics/resources/localization.html
before given your question answer,i tell you about multilingual in android basically in android application work in region wise means if i have device in usa -> install one application ->once it install if application was developed for multilingual support then it automatically render those string.
-> now question is how application build in multilingual for that you have to define string.xml for each language for your application will supports.
--for example : res/values <= default
--for Spanish : res/values-es
--for your question answer : if you define image with static way then it does not work.
For games that have images containing text you can use the same method as for normal strings.
Lets say, for strings you will have a strings.xml file under
values-en
values-es
values-de
values-fr
Then for images you can use (beware of the qualifiers precedence)
drawable-es-hdpi
drawable-en-hdpi
drawable-de-hdpi
drawable-fr-hdpi
However this will make your app bigger.
What I usually do is to generate the images programmatically, using a background and then rendering the text using some custom font on top of it. Even if the images are textures to be used on a 3D engine it works fine and I believe is a more reasonable approach.

Android standard icon for feedback/report by users

I want to add a feature on my app to let users give a feedback on data. (for example to report errors or mistakes).
Is there a standard icon for it?
please, visit your android-sdk-* folder, there should be default set of icons and pictures in the ./platforms/android-XX/data/res/drawable-Xdpi/ where "XX" and "X" stand for your android version and screen size. all the standard icons are there.
There are a few system icons whose filenames match 'feedback', but none of them look appropriate to me.
Best I could find is "ic_menu_report_image.png".
I've been using "ic_menu_start_conversation.png".
Whether it’s useful for your app mainly depends on the iconset you’re already using. In a chat-app for example, this icon would be a poor choice :)
Note: this icon is marked as protected. You'll have to copy the images to your source manually.
Because these resources can change between platform versions, you should not reference these icons using the Android platform resource IDs (i.e. menu icons under android.R.drawable). If you want to use any icons or other internal drawable resources, you should store a local copy of those icons or drawables in your application resources, then reference the local copy from your application code. In that way, you can maintain control over the appearance of your icons, even if the system's copy changes.

how to use different package for different device in android?

Hi i have develop a application in android which run in every device, i use different layout for different size device's but i have use some code programmatically without xml so, it create a problem in different size device.
so i require to change the package acording to the device resolution so, it can posible in android to programmatically detect and change the package class
plz, give some suggestion.
Thanking you.
i have use android2.2 for my application
No, it is not possible to programmatically change the application package. For device-specific display sizes you can create size-specific layouts as described in the guide and use getResources().getConfiguration() to programmatically choose specific code paths to execute.
"i use different layout for different size device's " means you just use dp/dip sizes or that you have completely different layouts for each screen size?
If you only used dp/dip units, then you can add a scalefactor to your code to get the matching coordinates. If you are using different layouts, it's much more difficult. Depending on how many different layout configurations you have, you could build seperate apk files and upload them parallel. The Market will handle the distribution of the matching files then.
Another way:
Create an installer app which checks the device configuration and downloads the device-specific package afterwards from a ftp/network resource.
After installation, delete the installer and the .apk file.

Categories

Resources