Change APP icon after installed - IONIC

Asked

Viewed 1,393 times

1

I am developing an APP in Ionic 1.x and would like to know if it is possible to change the APP icon after it installed on the user’s mobile phone.

I saw some solutions but all in code native to your devices.

Someone has that knowledge?

  • If I intend, just put the new icon in the app, generate the apk and have the client reinstall.

  • Hello @leopiazzoli, in case would change the icon AFTER installed, that is, change the icon dynamically by APP, via programming. For example: has a calendar APP that the icon gets the current day on the Auncher screens.

  • Now intendi. I can not say how to do yet because I never needed, but to have better answers I advise putting this example you quoted me and if possible images :)

2 answers

3

Native code solutions are valid, you can import the project you are working on (Ionic) in android studio and change the icons and generate in the new .apk. How to import this project ?

  1. When you run the command 'Ionic Platform add android' the Ionic will create a folder with a project that can be imported into android studio in the root folder of your project within Platforms android (when importing with android studio it will identify as an android project).
  2. After imported it you must change the images that are located inside the res/drawable folder (when changing the images observe the extensions and sizes) to keep a pattern you must keep the current ones.

0

Since iOS 10.3+ this is possible (since 2017), but for Cordova applications (like Ionic) it will depend on a specific plugin.

You can try this plug-in (only iOS, not Android) cordova-plugin-app-icon-changer

Install using:

cordova plugin add cordova-plugin-app-icon-changer

To check the support:

AppIconChanger.isSupported(function(supported) {
    if (supported) {
          ...
    } else {
          ...
    }
});

For change icon:

AppIconChanger.changeIcon({
    iconName: "<coloque o nome do icone aqui>",
    suppressUserNotification: true
}, function() {
     // Changed...
}, function(err) {
     // If failed ...
});

For more plugins, see: https://cordova.apache.org/plugins/? q=icon

Note: if something is desired, you can implement your own plug-in (or if you want to create a native application) using setAlternateIconName(_:completionHandler:)

It is important to check if the exchange is supported using supportsAlternateIcons

After placing the images on assets access Info.plist (CFBundleIcons) add CFBundleAlternateIcons with the items corresponding to the images, as in the example:

▼ CFBundleIcons
  ▼ CFBundleAlternateIcons
    ▼ <coloque o nome do icone aqui>
      ▶ CFBundleIconFiles

If you need iPad support, the structure should be similar to:

▼ CFBundleIcons
  ▼ CFBundleAlternateIcons
    ▼ <coloque o nome do icone aqui>
      ▶ CFBundleIconFiles
▼ CFBundleIcons~ipad
  ▼ CFBundleAlternateIcons
    ▼ <coloque o nome do icone aqui>
      ▶ CFBundleIconFiles

Image example for Cordova projects (e.g., Ionic)

info.plist

Android Cordova plug-ins

So far not found existing plugins that do this for Android, but according to this answer How to change an application icon programmatically in Android? (I couldn’t test the answers at the time), apparently it is possible to change the icon.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.