1

Not really an important question but was just curious. Can you change the app icon while running. For example, there is a button, and when you press the button, you get a different app icon (given that the app icons are already 'set') in flutter. Android and iOS.

Any input is greatly appreciated. Thanks

Programmer12
  • 89
  • 1
  • 8

2 Answers2

0

Since iOS 10.3, developers are able to programmatically change the app icon.

For details,You may can refer to this link, it shows how to dynamically change the app icon.

Sample code:

// change app icon to "Picture A"
@IBAction func pichuButtonDidTap(_ sender: UIButton) {
  changeIcon(to: "Picture A")
}

// change app icon to "Picture B"
@IBAction func pikachuButtonDidTap(_ sender: UIButton) {
  changeIcon(to: "Picture B")
}

// change app icon to "Picture C"
@IBAction func raichuButtonDidTap(_ sender: UIButton) {
  changeIcon(to: "Picture C")
}
func changeIcon(to iconName: String) {
  // 1
  guard UIApplication.shared.supportsAlternateIcons else {
    return
  }

  // 2
  UIApplication.shared.setAlternateIconName(iconName, completionHandler: { (error) in
    // 3
    if let error = error {
      print("App icon failed to change due to \(error.localizedDescription)")
    } else {
      print("App icon changed successfully")
    }
  })
}
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
0

You cannot change the manifest or the resource in the signed-and-sealed APK, except through a software upgrade.

Muhammad Zahab
  • 1,049
  • 10
  • 21