All Projects → EddyVerbruggen → nativescript-app-icon-changer

EddyVerbruggen / nativescript-app-icon-changer

Licence: MIT license
Change the homescreen icon of your NativeScript iOS app at runtime!

Programming Languages

typescript
32286 projects
shell
77523 projects

Projects that are alternatives of or similar to nativescript-app-icon-changer

nativescript-image-filters
NativeScript plugin to apply filters to images
Stars: ✭ 30 (+87.5%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-performance-monitor
⚡ Proof your app maintains 60-ish FPS by collecting data or showing it on screen with this NativeScript plugin!
Stars: ✭ 21 (+31.25%)
Mutual labels:  nativescript, nativescript-plugin
ui
Add right-to-left support to the NativeScript framework
Stars: ✭ 22 (+37.5%)
Mutual labels:  nativescript, nativescript-plugin
insomnia
😪 NativeScript plugin to keep the device awake (not dim the screen, lock, etc)
Stars: ✭ 40 (+150%)
Mutual labels:  nativescript, nativescript-plugin
Nativescript Vue
Native mobile applications using Vue and NativeScript.
Stars: ✭ 4,784 (+29800%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-app-shortcuts
👇 Home Icon Actions for your NativeScript app, now also for Android!
Stars: ✭ 45 (+181.25%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-ng-shadow
Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Stars: ✭ 54 (+237.5%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-star-printer
🌟 Print directly to Star Micronics printers from your NativeScript app! http://www.starmicronics.com/
Stars: ✭ 28 (+75%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-homekit
🏡 HomeKit plugin for your fancy NativeScript app
Stars: ✭ 23 (+43.75%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-vue-multi-drawer
A NativeScript-Vue component for creating multiple side drawers (4 sides supported)
Stars: ✭ 45 (+181.25%)
Mutual labels:  nativescript, nativescript-plugin
texttospeech
Text to Speech NativeScript plugin for Android & iOS 📢
Stars: ✭ 44 (+175%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-apple-sign-in
Sign In With Apple, as seen on WWDC 2019, available with iOS 13
Stars: ✭ 37 (+131.25%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-appversion
🔢 NativeScript plugin to retrieve your app's package ID and current version
Stars: ✭ 47 (+193.75%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-fabric
Handling App URLs in nativescript apps
Stars: ✭ 29 (+81.25%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-drawingpad
📝 NativeScript plugin to provide a way to capture any drawing (signatures are a common use case) from the device
Stars: ✭ 89 (+456.25%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-http
The best way to do HTTP requests in NativeScript, a drop-in replacement for the core HTTP with important improvements and additions like proper connection pooling, form data support and certificate pinning
Stars: ✭ 32 (+100%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-vue-examples
🍈 NativeScript and Vue code samples.
Stars: ✭ 13 (-18.75%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-clipboard
📋 NativeScript plugin to copy stuff to the device clipboard, and read from it again
Stars: ✭ 40 (+150%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-printer
📠 Send an image or the screen contents to a physical printer
Stars: ✭ 33 (+106.25%)
Mutual labels:  nativescript, nativescript-plugin
nativescript-store-update
No description or website provided.
Stars: ✭ 18 (+12.5%)
Mutual labels:  nativescript, nativescript-plugin

NativeScript App Icon Changer

Build Status NPM version Downloads Twitter Follow

That's the demo app in action, switching app icons like a boss!

Installation

tns plugin add nativescript-app-icon-changer

API

requiring / importing the plugin

All examples below assume you're using TypeScript, but here's how to require the plugin with regular JS as well:

JavaScript

var AppIconChangerPlugin = require("nativescript-app-icon-changer");
var appIconChanger = new AppIconChangerPlugin.AppIconChanger();

TypeScript

import { AppIconChanger } from "nativescript-app-icon-changer";

export class MyClass {
  private appIconChanger: AppIconChanger;
  
  constructor() {
    this.appIconChanger = new AppIconChanger();
  }
}

isSupported

Only iOS 10.3 and up support this feature, so you may want to check beforehand:

this.appIconChanger.isSupported().then(
    supported => console.log(`Supported: ${supported}`));

changeIcon

To be able to switch to a different icon add it to App_Resources/iOS and App_Resources/iOS/Info.plist as explained below and pass iconName to changeIcon.

To reset to the default icon, use iconName: null.

Note 1: iOS will notify the user the icon changed, but this plugin allows you to suppress that message (it's the default even). It's probably not what Apple would like you to do, but no apps have been disapproved with suppression enabled.

Note 2: Changing the app icon is only allowed when the app is in the foreground, so forget about that weather app which silently updates its app icon.

this.appIconChanger.changeIcon({
  iconName: "icon-blue", // or null to reset to the default
  suppressUserNotification: true
});

currentAlternateIcon

Want to know whether or not the app currently has an alternate icon configured? And if so, what its name is? Then use this:

// synchronous
const currentAppIconName: string = this.appIconChanger.currentAlternateIcon();

Preparing your app for icon switching

Apple doesn't allow switching to arbitrary icons, so they must be bundled with your app before releasing the app to the store.

Add the icons you'd like your users to be able to switch to for all relevant resolutions as usual.

Note that you DON'T NEED to provide all those resolutions; you could get away with adding just the largest resolution and refer to it in the plist file. iOS will scale it down to other resolutions for you.

Then reference those icons in App_Resources/iOS/Info.plist as well:

<plist>
<dict>

  <!-- Add or merge this bit -->
  <key>CFBundleIcons</key>
  <dict>
    <key>CFBundleAlternateIcons</key>
    <dict>
      <!-- The name you use in code -->
      <key>icon-blue</key>
      <dict>
        <key>UIPrerenderedIcon</key>
        <true/>
        <key>CFBundleIconFiles</key>
        <array>
          <!-- The actual filenames. Don't list the @2x/@3x files here -->
          <string>icon-blue-57</string>
          <string>icon-blue-60</string>
          <string>icon-blue-72</string>
          <string>icon-blue-76</string>
        </array>
      </dict>
    </dict>
  </dict>

</dict>
</plist>

Need iPad support as well? Just duplicate that plist config and change <key>CFBundleIcons</key> to <key>CFBundleIcons~ipad</key>.

Want to see this configured in an actual project? Look at the demo app to see the gory details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].