Switching between app icons programmatically in android - android

I have two different variants of an app with slightly different behavior. They share the same code, but the different behavior is through property files in the same project. I would like to have different icons for the apps.
Is there a way for me to change this programmatically? I have two sets of icons images in res/drawable-* folders, one for each app variant.
I've already looked at How to change an application icon programmatically in Android?, but that seems to be addressing a slightly different issue.

If I understand you, then you have an app, which functionality depends on a config file, and you want to have two different icon for the two installation of the app.
In this case, you have to change the package name, if you want to have these apps to be installed simultaneously. If so, you could change the icon manually too.
In any other case, you cannot change the icon of an application in running time.

If you are using ActionBarSherlock, try this:
getSupportActionBar().setIcon(R.drawable.ic_launcher_two);
If not, try this:
getActionBar().setIcon(R.drawable.ic_ic_launcher_two);

Related

Programmatically change Android application icon and name

Basically I just want to be able to programmatically change the application's name and icon
without it reverting to back the originals.
The main way people seem to be doing it is by using an activity-alias
in AndroidManifest.xml, but that seems to need you to use a different
Main package name, I don't want to have another one, I'd like to be able to
use the same one for both.
And, isn't using an activity-alias just going to temporarily change them?
Is there a different way to enable one and disable the other one without having
to use a different package name?
And is there any other reliable way to programmatically change the app icon and name?
It seems like a lot depends on what OS version you are using.
Oh, and not having to add any sketchy permissions if possible.
This on Windows.
Thanks!

How to make a flexible playstore app Icon that supports both "Normal Mode" and "Dark Mode"

I have recently pushed a React Native app to playstore and used an Icon to represent in playstore.When Dark Mode is enabled my app's playstore Icon's background turns black which makes Icon ugly. Now my doubt is
Do I have to use white background for Icon for all the future apps?
OR
Is there any way to make our Icon to be flexible in both Normal Mode and Dark Mode?
regarding your first question if the issue is only inside of playstore I think light background will not hurt. I dont think google play store offers a way to make this adaptive on their website.
regarding the second one, yes! inside your android project you can place alternative versions of your launcher icon inside of /res/mipmap-night-** resource folder btw it is possible you will need to create it. And also I recommend you actually create /res/mipmap-night-hdpi, /res/mipmap-night-xhdpi etc. to take into account the different screen resolutions. Since you are developing with react you would have to dive into your android project to find the res folder, or alternatively open your project in android studio and you will see it right away. this should change how your app looks on your users home screen
UPDATE
by mistake I had pointed to the drawable-night-** folders in my answer but Launcher icons in android are actually saved in the mipmap folders. I have now corrected this. I also tryed it out and it works (however I had to restart my device for it to take effect. asuming your users dont switch constantly between day and night mode they will always se the right icon for them)
Play Store icon it is a different image that you upload.
Make a complete white (or whatever) background to that image. In the official guidelines, Google says that you shouldn't make a partial background.
There is no "dark" icon in the Google Play Store; if you leave it transparent, it will display the default background color for each state (normal-dark).

Changing iOS and Android app's name and icon on the fly

Okay, I know the title is a bit confusing so let me explain it a little bit more.
We have different groups of clients and they want to have their own app, meaning the app name, icon, splash screen and theme colour are customized. But the functionalities and features remain the same across the whole product line.
Of course, we can submit different app for different client. But the maintenance would be a nightmare to the development team - each new feature / bug fixes needed to be pushed to different branches and we need to do multiple app update. Furthermore, we need to do manual testing on all the variants. We do not want to go down this road.
As a developer, I want to have a generic app for app submission and update. But once the client signed up then we change the app name, icon and splash screen according to his settings. I know I can do the splash screen and theme color - just render a different image and RGB value from the server on login. But I do not know if there is way to changed the app name and icon after the app installation.
I have also done preliminary search on this question but the answer I got is a no. Since those answers are from 2011 so I wonder if the situation has changed or not.
Many Thanks!
P.S. I found a group of apps on App Store which cover the question I asked. It is called DropLocker. They have 14 variants but I guess they use the same code base. I wonder if there is an update, do they push it individually or there is a way to do a multiple app updates at one shot.
For iOS apps, you can create targets in the same app and for each target you can change the appicons, splash screen, theme color etc.
To create target, go to your Project, On Left side, under "TARGETS", you will see, two targets, one with your Project name, other with Test. Right click your project and click "Duplicate". Then you can rename the target. Also rename the target in "Manage Schemes", to avoid confusion later on. Then, you can change the app name seperately for all targets in "info" section. Similarly, you can create a different sets of Appicons and splash screens and use them for different targets. To change theme color, you can define a "Preprocessor Macro" in Build Settings and use it inside your code. You can set the macro's value for different targets.

Can you change your app name (this under icon in list of application) dynamically?

I am wondering which name will be better for my app. I am thinking about experiment, which will change name of application (in 10% downloaded apps). Later I could check statistics which app was used more often.
Is this possible?
No. The app name is specified in your manifest so it will be static. You could change the name in the titlebar of the app though.
Picking a good name is key.
depending on exactly what you want you have a few options. You can call
this.setTitle("New Title Here");
from an Activity and this will change the title that appears at the top of the screen just beneath the notification bar. If you are trying to change the title that appears in the launcher, or on the home screen under the icon I don't think you can do this programmatically. You'd have to create two seperate versions of your application and use the different values for < application android:label> inside your manifest for each of them. Or maybe you could create another values folder like values-hdpi if the values folder works the same as the layout and drawable folders (which I suspect it does, but I've never tested.) then it would pull the value from the Strings.xml file inside the hdpi folder if the device has high density display, so you could get a different name for those devices. Maybe using this method you could use a language modifier like values-esp and somehow force the app to go into 'spanish mode' for a certain subset of users so that it pulls this alternate value.
If I understand your question correctly, you want to know if it's possible to test different names on the Android Market, correct?
The only way to do this with the Google Market is to have two separate copies of your app, but using different package names for each. The name that appears in the Market is set on the Developer Console, and while it can be changed, you will not see two different entries for your app in the market.
This is because the market uses your package name to identify your app, not the app name that you supply.
So, while it's easy to change the display name of the app while it is running by using setTitle as #Tim and #Robby have said, this only changes the app title while it is running - it does not affect the name used in the Android package manager, and it also does not affect the name displayed in the Market.
As I say above, if you are wanting to test which name is more popular and therefore results in more downloads, you will need to have multiple apps on the market with different package names. You will also then have to consider how to handle upgrades, and if one name turns out to be very popular, I don't think there's any facility to "upgrade" the other users to your new package name since they are different packages and therefore there is no upgrade path. This means you'll either have to inconvenience users of the old name by somehow asking them to switch to the new app name, or maintain all named versions of your app for the expected lifetime of it.
If you do get your users to switch to the new app, you will then also have to consider how to migrate their data. This can be done (3G watchdog does it when you upgrade from the lite version to pro), but it's an extra layer of complexity that you can avoid.

Make android app icon available to other applications

I would like my application icon to be available to other applications.
I understand this is a bit unclear so will try explain:
Applications such as Astros program manager lists applications with their icon. For all apps this is the correct icon as on the launcher, except mine which is displaying the standard android icon. I have set my icon as the manifest using: android:icon="#drawable/runninglate"
This works on the launcher but Astro still shows the default icon from when I create the project (which I deleted a long time ago). I have also tried renaming my icon file to icon.png in case this was a standard. This also failed to work.
I am clearly doing something wrong, or have missed a setting somewhere, can some one point me in the right direction.
Make sure you have your icon in the <application> element, perhaps in addition to having it in the <activity> element of the activity that should appear in the Launcher.
Seems it was a caching issue. I re-flashed my phone today for an update and the correct Icon was shown using the same APK as I was using when it wasn't showing. Maybe a clear data on the displaying app was all that was required!

Categories

Resources