Cordova-plugin-firebase: Android ์ƒํƒœ ํ‘œ์‹œ์ค„ ์•„์ด์ฝ˜ - ์ „์ฒด ํฐ์ƒ‰

์— ๋งŒ๋“  2016๋…„ 09์›” 13์ผ  ยท  25์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: arnesson/cordova-plugin-firebase

์•ˆ๋…•,
ํ‘ธ์‹œ ์•Œ๋ฆผ์ด ์ „๋‹ฌ๋  ๋•Œ Android ์ƒํƒœ ํ‘œ์‹œ์ค„์— ํ‘œ์‹œ๋˜๋Š” ์•„์ด์ฝ˜์„ ๋ณ€๊ฒฝํ•˜๋ ค๊ณ  ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์Œ์€ ํ˜„์žฌ ์ง„ํ–‰ ์ค‘์ธ ์ƒํ™ฉ์˜ ์˜ˆ์ž…๋‹ˆ๋‹ค.

screenshot_2016-09-13-08-53-22

๋ณด์‹œ๋‹ค์‹œํ”ผ ๋‚ด ์•ฑ์˜ ์•„์ด์ฝ˜์€ ํˆฌ๋ช…ํ•œ ์ด๋ฏธ์ง€๊ฐ€ ์•„๋‹™๋‹ˆ๋‹ค. ํˆฌ๋ช… ์ด๋ฏธ์ง€๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ํ‘ธ์‹œ ์•„์ด์ฝ˜์ด ๊ดœ์ฐฎ์•„ ๋ณด์ด์ง€๋งŒ ์•ฑ ์•„์ด์ฝ˜์€ ์ด์ œ ํˆฌ๋ช… ์ด๋ฏธ์ง€์ด๊ณ  ๋‚ด๊ฐ€ ์›ํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹™๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ํŒŒ์ผ ์ด๋ฆ„์„ ์‹œ๋„ํ–ˆ์ง€๋งŒ ์•„๋ฌด ๊ฒƒ๋„ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. 73ํ–‰์˜ src/android/FirebasePluginMessagingService.java ์ฝ”๋“œ๋ฅผ ์‚ดํŽด๋ณด๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.
.setSmallIcon(getApplicationInfo().icon)

์•ฑ ์•„์ด์ฝ˜๊ณผ ๋‹ค๋ฅธ ์•„์ด์ฝ˜์„ ์„ค์ •ํ•  ์ˆ˜ ์—†๋‹ค๋Š” ๋ง์ด ๋งž๋‚˜์š”?
์ƒํƒœ ํ‘œ์‹œ์ค„ ์•„์ด์ฝ˜์— ๋Œ€ํ•ด ๋‹ค๋ฅธ ํŒŒ์ผ์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?
๋˜๋Š” ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•œ ๋‹ค๋ฅธ ์ œ์•ˆ ์‚ฌํ•ญ์ด ์žˆ์Šต๋‹ˆ๊นŒ?

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

@blckshrk ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!! ๋‚˜๋Š” ๋งˆ์นจ๋‚ด ๊ทธ๊ฒƒ์„ ์ž‘๋™ ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค!

Ionic v2 ๋ฐ [email protected] ์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
์ด์˜จ: 2.2.2
์ฝ”๋ฅด๋„๋ฐ”: 6.5.0
npm: 4.6.1

  1. ์‚ฌ์šฉ์ž ์ง€์ • ๊ตฌ์„ฑ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
    $ ionic plugin add cordova-custom-config --fetch --save

  2. https://github.com/driftyco/ionic-package-hooks/blob/master/android_custom_resources.js ๋ฐ https://github.com/driftyco/ionic-package-hooks/blob/master/android_custom_values.js ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜์‹ญ์‹œ์˜ค. ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์— "package-hooks"(๋˜๋Š” ์›ํ•˜๋Š” ๋ชจ๋“  ๊ฒƒ)๋ผ๋Š” ์ƒˆ ๋””๋ ‰ํ† ๋ฆฌ.
    package-hooks/android_custom_resources.js
    package-hooks/android_custom_values.js

  3. ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ(ํ”Œ๋žซํผ ๋‚ด๋ถ€ ์•„๋‹˜)์— ๋‹ค์Œ ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
    resources/android/custom/notification_icon.png
    resources/android/values/styles.xml

notification_icon.png ๋Š” Android >= API 21 ์•Œ๋ฆผ ์•„์ด์ฝ˜์ž…๋‹ˆ๋‹ค. ๋‚ด ํฌ๊ธฐ๋Š” 144x144px์ด๋ฉฐ ๋ฉ‹์ง€๊ฒŒ ๋ณด์ž…๋‹ˆ๋‹ค.

styles.xml ์—๋Š” ๋‹ค์Œ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="red">#FF8614</color>
</resources>
  1. config.xml์„ ํŽธ์ง‘ํ•ฉ๋‹ˆ๋‹ค. ์ค‘์š” : ์œ„์ ฏ ํƒœ๊ทธ์— ํ•ด๋‹น ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    <widget ... xmlns:android="http://schemas.android.com/apk/res/android">
        <platform name="android">
            <hook src="package-hooks/android_custom_resources.js" type="after_prepare"/>
            <hook src="package-hooks/android_custom_values.js" type="after_prepare"/>
            <config-file parent="./application" target="AndroidManifest.xml">
                <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/>
                <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/red"/>
            </config-file>
        </platform>
    <widget>

๊ทธ๋ฆฌ๊ณ  ๊ทธ๊ฒŒ ๋‹ค์•ผ!

๋ชจ๋“  25 ๋Œ“๊ธ€

๋‚˜๋Š” ์ด๊ฒƒ์„ ํ…Œ์ŠคํŠธํ•˜์ง€ ์•Š์•˜์ง€๋งŒ fcm_push_icon.png๋ฅผ ํ•„์š”ํ•œ ๋ชจ๋“  ํฌ๊ธฐ๋กœ ๋งŒ๋“ค์–ด ์‚ฌ์šฉ์ž ์ •์˜ ์•„์ด์ฝ˜์„ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. fcm_push_icon.png๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด ๊ธฐ๋ณธ์ ์œผ๋กœ ์•ฑ ์•„์ด์ฝ˜์ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์•„์ด์ฝ˜์€ android/res ํด๋” ํŠธ๋ฆฌ์— ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ด๊ฒƒ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์–‘ํ•œ ํฌ๊ธฐ๋ฅผ ๋ชจ๋‘ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. http://romannurik.github.io/AndroidAssetStudio/icons-notification.html

์•ˆ๋…•ํ•˜์„ธ์š”, ์šฐ๋ฆฌ๋Š” ๊ฐ™์€ ๋ฌธ์ œ์— ์ง๋ฉดํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. android/res ํด๋” ํŠธ๋ฆฌ์— fcm_push_icon.png ์•„์ด์ฝ˜์„ ๋ฐฐ์น˜ํ•˜๋ ค๊ณ  ํ–ˆ์ง€๋งŒ ์•Œ๋ฆผ ์•„์ด์ฝ˜์€ ์—ฌ์ „ํžˆ โ€‹โ€‹ํฐ์ƒ‰์ž…๋‹ˆ๋‹ค.

@MikeBateman ํ•ด๊ฒฐ์ฑ…์„ ์ฐพ์•˜์Šต๋‹ˆ๊นŒ?

์•ˆ๋…•ํ•˜์„ธ์š”, ์•ฑ์˜ ๋Œ€์ƒ SDK๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋Š” ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ ค๋ฉด ์ด๊ฒƒ์„ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค. ๋ฌผ๋ก  ์ ์ ˆํ•œ ์†”๋ฃจ์…˜์€ ์•„๋‹™๋‹ˆ๋‹ค.

๋‚˜๋Š” ์—ฐ๊ตฌํ•˜๊ณ ์ด ์†”๋ฃจ์…˜์„ ์–ป์—ˆ์Šต๋‹ˆ๋‹ค.

์ด ๊ฒฝ๋กœ src/android/FirebasePluginMessagingService.java๋กœ ์ด๋™ํ•˜์—ฌ .setSmallIcon(getApplicationInfo().icon) ํ–‰์„ ์ฐพ์œผ์‹ญ์‹œ์˜ค( @MikeBateman ์–ธ๊ธ‰๊ณผ ๊ฐ™์ด). ์ด์ œ ์•ฑ์ด Android lollipop+์—์„œ ์‹คํ–‰ ์ค‘์ธ์ง€ ํ™•์ธํ•˜๋Š” ์กฐ๊ฑด์„ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค. ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ ๋จธํ‹ฐ๋ฆฌ์–ผ ๋””์ž์ธ ์•„์ด์ฝ˜ ์„ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๊ธฐ๋ณธ ์•ฑ ์•„์ด์ฝ˜์ธ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

...

  .setSmallIcon(getNotificationIcon())
...

//At the end of FirebasePluginMessagingService.java 
    private int getNotificationIcon() {
        boolean useWhiteIcon = (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP);
        System.out.println("SCLMTEST >lollipop?:"+useWhiteIcon);
        return useWhiteIcon ? R.drawable.myMaterialIcon: getApplicationInfo().icon;
    }

๋‚ด ์ƒ๊ฐ์— ๊ฐ€์žฅ ์ข‹์€ ๊ฒƒ์€ myappresources์— ๋จธํ‹ฐ๋ฆฌ์–ผ ๋””์ž์ธ ์•„์ด์ฝ˜์„ ๋„ฃ๊ณ  ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์ด ์ž‘์—…์„ ์ž์ฒด์ ์œผ๋กœ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ด์ œ ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ• ์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋ˆ„๊ตฐ๊ฐ€ ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด ํ›Œ๋ฅญํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋„์›€์ด ๋˜๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค! @delphaber

33c52c7e8a1835d5f595e58eaef43e4f49b4b23a์— ๊ณ ์ •

ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ์ด์ œ ๋“œ๋กœ์–ด๋ธ”์—์„œ notification_icon์ด ์žˆ๋Š” ๊ฒฝ์šฐ ์ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ๊ธฐ๋ณธ ์•ฑ ์•„์ด์ฝ˜์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค

์•ผ,

๋‚˜๋Š” ๊ทธ๊ฒƒ์„ ์ดํ•ดํ•˜์ง€ ๋ชปํ•œ๋‹ค. ๊ฐ ๋“œ๋กœ์–ด๋ธ” ํด๋”(๊ฐ ํฌ๊ธฐ์— ๋Œ€ํ•ด)์— notification_icon.png ๋ฅผ ๋„ฃ์œผ๋ ค๊ณ  ํ•˜์ง€๋งŒ ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ์—ฌ์ „ํžˆ โ€‹โ€‹๊ธฐ๋ณธ ํด๋”(์•ฑ ์•„์ด์ฝ˜)๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๋‚ด๊ฐ€ ๋ญ”๊ฐ€๋ฅผ ๋†“์ณค๋‚˜์š”?

๊ฐ์‚ฌ ํ•ด์š”!

@blckshrk cc/ @robertarnesson

Android src ํŒŒ์ผ์„ ์—…๋ฐ์ดํŠธํ•˜๊ณ  ๋ชจ๋“  notification_icon.png ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•œ ํ›„์—๋„ ์—ฌ์ „ํžˆ ํฐ์ƒ‰ ์‚ฌ๊ฐํ˜•์ด ํ‘œ์‹œ๋˜๋Š” ๋™์•ˆ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‚˜๋Š” ์—ฌ๊ธฐ์—์„œ ์กฐ์–ธ์„ ๋”ฐ๋ž๋‹ค: http://stackoverflow.com/questions/37325051/notification-icon-with-the-new-firebase-cloud-messaging-system

๋จผ์ € ๋‚ด ์ปดํ“จํ„ฐ์—์„œ ์ตœ์‹  Firebase SDK๋ฅผ ์ตœ์‹  ์ƒํƒœ๋กœ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด Google Repository๋ฅผ ์—…๋ฐ์ดํŠธํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ com.google.firebase:firebase-core ์— ๋Œ€ํ•œ ๋ฒ„์ „ 9.8.0์ด๋ฉฐ ์ด ๊ธ€์„ ์“ฐ๋Š” ์ˆœ๊ฐ„์— ์ž‘๋™ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. (๋‚˜๋Š” ์ด์ „์— 9.4.0์— ์žˆ์—ˆ๋‹ค)

๊ทธ๋Ÿฐ ๋‹ค์Œ ์ด๊ฒƒ์„ AndroidManifest.xml ์— ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />

default_notification_color ๋ฅผ ๋ณ€๊ฒฝํ•˜๋Š” ์˜ต์…˜์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋‹ค์Œ์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์šฐ๋ฆฌ ์•„์ด์ฝ˜์€ ๋ฐฐ๊ฒฝ์ด ํˆฌ๋ช…ํ•œ ํฐ์ƒ‰ ์•„์ด์ฝ˜์ด๋ฏ€๋กœ ์ž ๊ธˆ ํ™”๋ฉด์—์„œ ๋ฉ‹์ง„ ์ƒ‰์ƒ์„ ๋’ค์— ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

<meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/orange" />

๋˜ํ•œ ๋‹ค์Œ๊ณผ ํ•จ๊ป˜ res/values/colors.xml ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋ฌผ๋ก  ๋ฐฐ๊ฒฝ์„ ์„ค์ •ํ•˜๋Š” ๊ฒฝ์šฐ ์›ํ•˜๋Š” ์ƒ‰์ƒ์„ ์„ ํƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="orange">#FF8614</color>
</resources>

์ด๊ฒƒ์€ ๋ชจ๋‘ Firebase 9.8.0๋ถ€ํ„ฐ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

@blckshrk ํ”„๋กœ์ ํŠธ์— ์•„์ด์ฝ˜์„ ์–ด๋–ป๊ฒŒ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๊นŒ? ํ”„๋กœ์ ํŠธ์˜ config.xml์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฆฌ์†Œ์Šค์— ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํด๋”์— ๋„ฃ์œผ๋ฉด ๋‚ด๊ฐ€ ์•„๋Š” ํ•œ ์ฝ”๋“œ์— ํ‘œ์‹œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

ํ˜„์žฌ Ionic 2๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์•ฑ์„ ๋งŒ๋“ค๊ณ  ๋‹ค์Œ์„ ์ˆ˜ํ–‰ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
ionic์˜ res ํด๋”์— ์•„์ด์ฝ˜ ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•˜์˜€์œผ๋ฏ€๋กœ ionic resources ๋ช…๋ น์„ ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์–‘ํ•œ ํ™”๋ฉด ํฌ๊ธฐ์˜ ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

config.xml ํŒŒ์ผ์— ์ด๋ฏธ์ง€ ๊ฒฝ๋กœ๋„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

์ •ํ™•ํžˆ ์–ด๋–ป๊ฒŒ ํ•ด์•ผํ•˜๋Š”์ง€ ๋‹ต๋ณ€์ข€ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค..

  • Android์šฉ์œผ๋กœ ์ •ํ™•ํžˆ ์–ด๋–ค ํด๋”์— ํŒŒ์ผ์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•˜๋Š”์ง€์™€ ๊ฐ™์€
  • config.xml ํŒŒ์ผ์— ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๊นŒ?
  • ํŒŒ์ผ์˜ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋Š” ์–ผ๋งˆ์ž…๋‹ˆ๊นŒ

๋‚˜๋Š” ๋„ค์ดํ‹ฐ๋ธŒ ์•ˆ๋“œ๋กœ์ด๋“œ ์ฝ”๋“œ์™€ ํด๋” ๊ตฌ์กฐ์— ๋Œ€ํ•œ ์ง€์‹์ด ์—†์œผ๋ฏ€๋กœ ๊ทธ์— ๋”ฐ๋ผ ๋‹ต์žฅ์„ ๋ณด๋‚ด์ฃผ์„ธ์š”.

-๊ฐ์‚ฌ ํ•ด์š”

์‹ค์ œ๋กœ @prantikv ์ฒ˜๋Ÿผ ๋‚˜๋Š” ์•ฝ๊ฐ„ ๊ธธ์„ ์žƒ์—ˆ์Šต๋‹ˆ๋‹ค. Ionic 1์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค(๊ทธ๋Ÿฌ๋‚˜ ๋™์ผํ•œ ์›Œํฌํ”Œ๋กœ ์‚ฌ์šฉ). ๋‚ด ์•„์ด์ฝ˜์„ res/drawable/ ๋„ฃ๊ณ  cordova-custom-config ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ AndroidManifest.xml ( manifest ๋…ธ๋“œ์—์„œ ์ง์ ‘)์— <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" /> ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ ค๊ณ  ํ–ˆ์ง€๋งŒ ์•„๋ฌด๊ฒƒ๋„ ์˜ˆ์ƒ๋Œ€๋กœ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

@gylippus com.google.firebase:firebase-core ๋ถ€๋ถ„์„ โ€‹โ€‹์ดํ•ดํ•˜์ง€ ๋ชปํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„์ „์€ ์–ด๋–ป๊ฒŒ ํ™•์ธํ•˜๋‚˜์š”?

๊ณ ๋งˆ์›Œ ์–˜๋“ค์•„!

@robertarnesson @gylippus ์ž‘์—… ์˜ˆ์‹œ๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ?

๋‚˜๋Š” cordova-custom-config ์™€ ํ•จ๊ป˜ ์ž‘๋™ํ•˜๋„๋ก ๊ด€๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

<config-file parent="./application" target="AndroidManifest.xml">
          <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
</config-file>

๊ทธ๋ฆฌ๊ณ  platforms/android/res/drawable/notification_icon.png

๋„์™€ ์ฃผ์…”์„œ ์ •๋ง๋กœ ๊ณ ๋ง™์Šต๋‹ˆ๋‹ค !

notification_icon.png ๊ฐ€ ๋ฃจํŠธ(๋˜๋Š” resources ) ํด๋”์— ์žˆ๋Š” ๊ฒฝ์šฐ ์ด ์ž‘์—…์„ ์ž๋™์œผ๋กœ ์ˆ˜ํ–‰ํ•˜๋Š” ํ›„ํฌ(ํŒŒ์ผ ์ด๋™ ๋ฐ ๋งค๋‹ˆํŽ˜์ŠคํŠธ ํŽธ์ง‘)๊ฐ€ ์žˆ์œผ๋ฉด ์ข‹์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ตฌ์„ฑ ํŒŒ์ผ). ๊ทธ๊ฒƒ์— ๋Œ€ํ•ด ์–ด๋–ป๊ฒŒ ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๊นŒ?

@blckshrk
์–ธ๊ธ‰ ํ•œ๋Œ€๋กœ ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋ ค๊ณ  ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค.

<config-file parent="./application" target="AndroidManifest.xml">
          <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
</config-file>

๊ทธ๋Ÿฌ๋‚˜ ๋นŒ๋“œ ํ”„๋กœ์„ธ์Šค ์ค‘์— ๋‹ค์Œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

:processDebugResources
E:\Development\IONIC 2\allcouriertracking\allcouriertracking5\platforms\android\res\xml\config.xml:57 : AAPT: Error parsing XML: unbound prefix


 FAILED

FAILURE: Build failed with an exception.


:processDebugResources
E:\Development\IONIC 2\allcouriertracking\allcouriertracking5\platforms\android\res\xml\config.xml:57 : AAPT: Error parsing XML: unbound prefix


 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'I:\DEVELOPMENT PROGRAMS\android-sdk-windows\build-tools\24.0.3\aapt.exe'' finished with non-zero exit value 1

๊ทธ๋Ÿฐ ๋‹ค์Œ AndroidManifest.xml์— ๋‹ค์Œ์„ ์ˆ˜๋™์œผ๋กœ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />

Android 4.4์—์„œ๋Š” ์ž‘๋™ํ–ˆ์ง€๋งŒ Android 5.1์—์„œ๋Š” ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์–ด๋–ค ๋ฒ„์ „์„ ์œ„ํ•ด ๋นŒ๋“œํ•˜์…จ๋‚˜์š”?
๋˜ํ•œ notification_icon.png ํŒŒ์ผ์„ ๋ชจ๋“  drawable ํด๋”์— ์ถ”๊ฐ€ํ•˜์…จ์Šต๋‹ˆ๊นŒ ์•„๋‹ˆ๋ฉด ํ•˜๋‚˜๋งŒ ์ถ”๊ฐ€ํ•˜์…จ์Šต๋‹ˆ๊นŒ?

@prantikv https://github.com/dpa99c/cordova-custom-config ๋ฅผ ์„ค์น˜ํ•˜์…จ์Šต๋‹ˆ๊นŒ?

์‹ค์ œ๋กœ ์ €๋Š” ์ด ํ›„ํฌ https://github.com/driftyco/ionic-package-hooks/blob/master/android_custom_resources.js ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ notification_icon.png ํŒŒ์ผ์„ ๊ฐ ๋“œ๋กœ์–ด๋ธ” ํด๋”๋กœ ์ž๋™ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

๊ธฐ๋ณธ์ ์œผ๋กœ <platform name="android"> ๋…ธ๋“œ ์•ˆ์— ์ด๊ฒƒ์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

<hook src="hooks/after_prepare/android_custom_resources.js" type="after_prepare"/>
<config-file parent="./application" target="AndroidManifest.xml">
    <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
</config-file>

ํŽธ์ง‘ํ•˜๋‹ค

๋‚˜๋Š” ๋˜ํ•œ https://github.com/driftyco/ionic-package-hooks/blob/master/android_custom_values.js ํ›„ํฌ์™€ @gylippus ๊ฐ€ ์ œ์•ˆํ•œ ์†”๋ฃจ์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์ƒ‰์ƒ์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค(๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!)

@blckshrk ์˜ˆ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๋‹ค.. ์‚ฌ์šฉ ์ค‘์ธ ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋ฅผ ์•Œ๋ ค์ฃผ์‹ค ์ˆ˜ ์žˆ๋‚˜์š”.. ์ด๋ฏธ์ง€ ์น˜์ˆ˜์™€ ํฌ๊ธฐ(KB).
๊ทธ๋ฆฌ๊ณ  ํ…Œ์ŠคํŠธํ•œ ํ”Œ๋žซํผ์ž…๋‹ˆ๋‹ค.

์ด์— ๋Œ€ํ•œ ์—…๋ฐ์ดํŠธ๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ? 20์ผ์งธ์ธ๋ฐ ์•„์ง๋„ ํ•ด๊ฒฐ์ด ์•ˆ๋˜๋‚˜์š”? ๊ทธ๋ž˜๋„ ๋ฌธ์ œ๋ผ๋ฉด ๋‹ซ์„ ์ˆ˜ ์—†๋‹ค?!

๋‚˜๋Š” ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๊ณ  ์„œ๋ฒ„ ์ธก์—์„œ ํ•ด๊ฒฐํ•  ์ˆ˜์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๋‚˜๋Š” notification_icon.png๋ผ๋Š” ์ด๋ฆ„์˜ platform-android ํด๋” ์•ˆ์˜ drawable ํด๋”์— ์•„์ด์ฝ˜์„ ์ˆ˜๋™์œผ๋กœ ๋ฐฐ์น˜ํ–ˆ์Šต๋‹ˆ๋‹ค.
Firebase ์ฝ˜์†”์„ ํ†ตํ•ด ๊ณ„์† ์ž˜๋ชป๋œ ์•„์ด์ฝ˜์ด ํ‘œ์‹œ๋˜์ง€๋งŒ ์ž์ฒด ์„œ๋ฒ„์—์„œ ์š”์ฒญ ๋ณธ๋ฌธ์œผ๋กœ ๋‹ค์Œ์„ ๋ณด๋ƒ…๋‹ˆ๋‹ค.

$fields = array(
  "registration_ids" => "array of registration ids",
  "notification" => array(
    "body"=>"message to send as a body",
    "icon"=>"notification_icon",
    "color"=>"your color in hex"
  ),
  "priority"=>10
);

์ด ๋„์›€์„ ๋ฐ”๋ž๋‹ˆ๋‹ค

์‹ค์ œ๋กœ ์ผ๋ถ€ ๋กœ๊น… ๋ฐ ์ฝ๊ธฐ ํ›„์— FirebasePluginMessagingService.java / sendNotification ์˜ ์ „์ฒด notificationBuilder ์ฝ”๋“œ๋Š” ์•Œ๋ฆผ ํŽ˜์ด๋กœ๋“œ๊ฐ€ ์žˆ์„ ๋•Œ ์‹คํ–‰๋˜์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์— ๋ฌด์˜๋ฏธํ•œ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์•„์ด์ฝ˜ ๋ฌธ์ œ ์™ธ์—๋„ ๋‚˜๋Š” notificationBuilder ์ฝ”๋“œ๊ฐ€ .setSound(defaultSoundUri)๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด๊ฒƒ์„ ์˜์‹ฌํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ์ง€๋งŒ ์•Œ๋ฆผ์ด ํŠธ๋ ˆ์ด์— ๋„์ฐฉํ•˜๋ฉด ์žฌ์ƒ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์ด๊ฒƒ์ด ์•Œ๋ฆผ์ด ํ”Œ๋Ÿฌ๊ทธ์ธ ์ฝ”๋“œ์— ์˜ํ•ด ๋นŒ๋“œ๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์•Œ๋ฆผ ํŽ˜์ด๋กœ๋“œ์—์„œ ์ง€์‹œ๋ฅผ ๋ฐ›๋Š” FCM ์ž์ฒด์— ์˜ํ•ด ๋นŒ๋“œ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์œ„์˜ sergiojup์˜ ์†”๋ฃจ์…˜์ด ์ž‘๋™ํ•˜๋Š” ์ด์œ ์ž…๋‹ˆ๋‹ค.

์™œ.. Android์—์„œ onMessageReceived๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋งŒ ํ˜ธ์ถœ๋ฉ๋‹ˆ๋‹ค.
*) ์•Œ๋ฆผ ํŽ˜์ด๋กœ๋“œ๋งŒ ์žˆ๊ณ  ์•ฑ์ด ํฌ๊ทธ๋ผ์šด๋“œ์— ์žˆ์Šต๋‹ˆ๋‹ค.
*) ์•Œ๋ฆผ ํŽ˜์ด๋กœ๋“œ์™€ ๋ฐ์ดํ„ฐ ํŽ˜์ด๋กœ๋“œ๊ฐ€ ์žˆ๊ณ  ์•ฑ์ด ํฌ๊ทธ๋ผ์šด๋“œ์— ์žˆ์Šต๋‹ˆ๋‹ค.
*) ๋ฐ์ดํ„ฐ ํŽ˜์ด๋กœ๋“œ๋งŒ ์žˆ๊ณ  ์•ฑ์ด ํฌ๊ทธ๋ผ์šด๋“œ ๋˜๋Š” ๋ฐฑ๊ทธ๋ผ์šด๋“œ์— ์žˆ์Šต๋‹ˆ๋‹ค.

๋”ฐ๋ผ์„œ ์ด๋Ÿฌํ•œ ๊ฒฝ์šฐ onMessageReceived๋Š” ํ˜ธ์ถœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
*) ์•Œ๋ฆผ ํŽ˜์ด๋กœ๋“œ๋งŒ ์žˆ๊ณ  ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ์— ์žˆ์Šต๋‹ˆ๋‹ค.
*) ์•Œ๋ฆผ ํŽ˜์ด๋กœ๋“œ ๋ฐ ๋ฐ์ดํ„ฐ ํŽ˜์ด๋กœ๋“œ๊ฐ€ ์žˆ๊ณ  ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ์— ์žˆ์Œ

์ฝ”๋“œ๋ฅผ ๋ณด๋ฉด ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ์•Œ๋ฆผ์„ ๋นŒ๋“œํ•˜๋„๋ก ํ•˜๋Š” ์œ ์ผํ•œ ๋ฐฉ๋ฒ•์€ ์•ฑ์ด ๋ฐฑ๊ทธ๋ผ์šด๋“œ์— ์žˆ๋Š” ๋™์•ˆ ์ œ๋ชฉ๊ณผ ํ…์ŠคํŠธ ์†์„ฑ์ด ๋ชจ๋‘ ์žˆ๋Š” ๋ฐ์ดํ„ฐ ํŽ˜์ด๋กœ๋“œ๋งŒ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

@blckshrk ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค!! ๋‚˜๋Š” ๋งˆ์นจ๋‚ด ๊ทธ๊ฒƒ์„ ์ž‘๋™ ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค!

Ionic v2 ๋ฐ [email protected] ์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
์ด์˜จ: 2.2.2
์ฝ”๋ฅด๋„๋ฐ”: 6.5.0
npm: 4.6.1

  1. ์‚ฌ์šฉ์ž ์ง€์ • ๊ตฌ์„ฑ ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
    $ ionic plugin add cordova-custom-config --fetch --save

  2. https://github.com/driftyco/ionic-package-hooks/blob/master/android_custom_resources.js ๋ฐ https://github.com/driftyco/ionic-package-hooks/blob/master/android_custom_values.js ๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜์‹ญ์‹œ์˜ค. ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ์— "package-hooks"(๋˜๋Š” ์›ํ•˜๋Š” ๋ชจ๋“  ๊ฒƒ)๋ผ๋Š” ์ƒˆ ๋””๋ ‰ํ† ๋ฆฌ.
    package-hooks/android_custom_resources.js
    package-hooks/android_custom_values.js

  3. ํ”„๋กœ์ ํŠธ ๋ฃจํŠธ(ํ”Œ๋žซํผ ๋‚ด๋ถ€ ์•„๋‹˜)์— ๋‹ค์Œ ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
    resources/android/custom/notification_icon.png
    resources/android/values/styles.xml

notification_icon.png ๋Š” Android >= API 21 ์•Œ๋ฆผ ์•„์ด์ฝ˜์ž…๋‹ˆ๋‹ค. ๋‚ด ํฌ๊ธฐ๋Š” 144x144px์ด๋ฉฐ ๋ฉ‹์ง€๊ฒŒ ๋ณด์ž…๋‹ˆ๋‹ค.

styles.xml ์—๋Š” ๋‹ค์Œ์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="red">#FF8614</color>
</resources>
  1. config.xml์„ ํŽธ์ง‘ํ•ฉ๋‹ˆ๋‹ค. ์ค‘์š” : ์œ„์ ฏ ํƒœ๊ทธ์— ํ•ด๋‹น ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋ฅผ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
    <widget ... xmlns:android="http://schemas.android.com/apk/res/android">
        <platform name="android">
            <hook src="package-hooks/android_custom_resources.js" type="after_prepare"/>
            <hook src="package-hooks/android_custom_values.js" type="after_prepare"/>
            <config-file parent="./application" target="AndroidManifest.xml">
                <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/>
                <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/red"/>
            </config-file>
        </platform>
    <widget>

๊ทธ๋ฆฌ๊ณ  ๊ทธ๊ฒŒ ๋‹ค์•ผ!

config.xml์— ๋‹ค์Œ์„ ์ถ”๊ฐ€ํ•  ์œ„์น˜๋ฅผ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ทธ๊ฒƒ์— ๋Œ€ํ•œ ํŒ? ๋˜ํ•œ XML์— ์ต์ˆ™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋„ค์ž„์ŠคํŽ˜์ด์Šค์— ์ •ํ™•ํžˆ ๋ฌด์—‡์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•ฉ๋‹ˆ๊นŒ? @shamank

<widget ... xmlns:android="http://schemas.android.com/apk/res/android"> <platform name="android"> <hook src="package-hooks/android_custom_resources.js" type="after_prepare"/> <hook src="package-hooks/android_custom_values.js" type="after_prepare"/> <hook src="package-hooks/android_fixes.js" type="after_prepare"/> <config-file parent="./application" target="AndroidManifest.xml"> <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/> <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/red"/> </config-file> </platform> <widget>

@Rockforced ์ฃ„์†กํ•ฉ๋‹ˆ๋‹ค, ์ œ๊ฐ€ ์š”์ฆ˜ ์ฃผ๋ณ€์— ์—†์—ˆ์Šต๋‹ˆ๋‹ค. ์›๋ณธ ํŒŒ์ผ์„ ์‚ดํŽด๋ณด์‹ญ์‹œ์˜ค(๋ฌผ๋ก  ์ผ๋ถ€ ๊ต์ฒด๋œ ํ•ญ๋ชฉ ํฌํ•จ). ๋„์›€์ด ๋˜๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.example" version="1.0.20" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
    <name>Test</name>
    <description>Blabla.</description>
    <author email="[email protected]" href="https://example.com/">Example</author>
    <content src="index.html"/>
    <access origin="*"/>
    <allow-navigation href="http://ionic.local/*"/>
    <allow-navigation href="http://192.168.0.1:8100"/>
    <allow-intent href="http://*/*"/>
    <allow-intent href="https://*/*"/>
    <allow-intent href="tel:*"/>
    <allow-intent href="sms:*"/>
    <allow-intent href="mailto:*"/>
    <allow-intent href="geo:*"/>
    <platform name="android">
        <allow-intent href="market:*"/>
        <hook src="package-hooks/android_custom_resources.js" type="after_prepare"/>
        <hook src="package-hooks/android_custom_values.js" type="after_prepare"/>
        <hook src="package-hooks/android_fixes.js" type="after_prepare"/>
        <config-file parent="./application" target="AndroidManifest.xml">
            <meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon"/>
            <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/red"/>
        </config-file>
        <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png"/>
        <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png"/>
        <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png"/>
        <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png"/>
        <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png"/>
        <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png"/>
        <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png"/>
        <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png"/>
        <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png"/>
        <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png"/>
        <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png"/>
        <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png"/>
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*"/>
        <allow-intent href="itms-apps:*"/>
        <icon height="57" src="resources/ios/icon/icon.png" width="57"/>
        <icon height="114" src="resources/ios/icon/[email protected]" width="114"/>
        <icon height="40" src="resources/ios/icon/icon-40.png" width="40"/>
        <icon height="80" src="resources/ios/icon/[email protected]" width="80"/>
        <icon height="120" src="resources/ios/icon/[email protected]" width="120"/>
        <icon height="50" src="resources/ios/icon/icon-50.png" width="50"/>
        <icon height="100" src="resources/ios/icon/[email protected]" width="100"/>
        <icon height="60" src="resources/ios/icon/icon-60.png" width="60"/>
        <icon height="120" src="resources/ios/icon/[email protected]" width="120"/>
        <icon height="180" src="resources/ios/icon/[email protected]" width="180"/>
        <icon height="72" src="resources/ios/icon/icon-72.png" width="72"/>
        <icon height="144" src="resources/ios/icon/[email protected]" width="144"/>
        <icon height="76" src="resources/ios/icon/icon-76.png" width="76"/>
        <icon height="152" src="resources/ios/icon/[email protected]" width="152"/>
        <icon height="167" src="resources/ios/icon/[email protected]" width="167"/>
        <icon height="29" src="resources/ios/icon/icon-small.png" width="29"/>
        <icon height="58" src="resources/ios/icon/[email protected]" width="58"/>
        <icon height="87" src="resources/ios/icon/[email protected]" width="87"/>
        <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640"/>
        <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750"/>
        <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242"/>
        <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536"/>
        <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768"/>
        <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640"/>
        <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320"/>
    </platform>
    <preference name="webviewbounce" value="false"/>
    <preference name="UIWebViewBounce" value="false"/>
    <preference name="DisallowOverscroll" value="true"/>
    <preference name="android-minSdkVersion" value="16"/>
    <preference name="android-targetSdkVersion" value="23"/>
    <preference name="BackupWebStorage" value="none"/>
    <preference name="SplashMaintainAspectRatio" value="true"/>
    <preference name="SplashReloadOnOrientationChange" value="true"/>
    <preference name="SplashScreenDelay" value="3000"/>
    <preference name="FadeSplashScreen" value="false"/>
    <preference name="FadeSplashScreenDuration" value="0"/>
    <preference name="orientation" value="portrait"/>
    <preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF"/>
    <preference name="SplashScreen" value="screen"/>
    <preference name="AutoHideSplashScreen" value="false"/>
    <preference name="KeyboardDisplayRequiresUserAction" value="false"/>
    <preference name="loadUrlTimeoutValue" value="700000"/>
    <feature name="StatusBar">
        <param name="ios-package" onload="true" value="CDVStatusBar"/>
    </feature>
    <feature name="InAppBrowser">
        <param name="ios-package" value="CDVInAppBrowser"/>
        <param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser"/>
    </feature>
    <plugin name="cordova-plugin-app-event" spec="~1.2.0"/>
    <plugin name="cordova-plugin-device" spec="~1.1.3"/>
    <plugin name="cordova-plugin-console" spec="~1.0.4"/>
    <plugin name="cordova-plugin-whitelist" spec="~1.3.2"/>
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.2"/>
    <plugin name="cordova-plugin-statusbar" spec="~2.2.2"/>
    <plugin name="ionic-plugin-keyboard" spec="~2.2.1"/>
    <plugin name="cordova-plugin-geolocation" spec="~2.4.1"/>
    <plugin name="cordova-plugin-compat" spec="~1.1.0"/>
    <plugin name="cordova-plugin-inappbrowser" spec="~1.6.1"/>
    <plugin name="cordova-plugin-nativestorage" spec="~2.2.2"/>
    <plugin name="cordova-plugin-firebase" spec="~0.1.20"/>
    <plugin name="cordova.plugins.diagnostic" spec="~3.0.4"/>
    <plugin name="cordova-plugin-googlemaps" spec="~1.4.0">
        <variable name="API_KEY_FOR_ANDROID" value="blabla"/>
        <variable name="API_KEY_FOR_IOS" value="blabla"/>
    </plugin>
    <plugin name="ionic-plugin-deeplinks" spec="~1.0.14">
        <variable name="URL_SCHEME" value="blabla"/>
        <variable name="DEEPLINK_SCHEME" value="https"/>
        <variable name="DEEPLINK_HOST" value="www.blabla.com"/>
        <variable name="ANDROID_PATH_PREFIX" value="/"/>
    </plugin>
    <plugin name="cordova-custom-config" spec="~3.2.0"/>
    <icon src="resources/ios/icon/[email protected]"/>
    <engine name="android" spec="~6.2.2"/>
</widget>

@shamank ์ด๊ฒƒ์— ๋Œ€ํ•ด ๋Œ€๋‹จํžˆ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ํ•˜๋ฃจ ์ข…์ผ ๋ฒ„์ „ 0.1.24์™€ ์‹ธ์›Œ์„œ ์šด์ด ์—†์—ˆ๊ณ  ์†”๋ฃจ์…˜์ด ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ์‚ฌ์šฉ์ž ์ •์˜ ์•„์ด์ฝ˜์ด ์ž‘๋™ํ•˜๋Š” ์ด์œ ๋ฅผ ์ •ํ™•ํžˆ ์•Œ๋ ค์ฃผ์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ? ๋‚˜๋Š” ๋‚˜๋ฅผ ์•„์ฃผ ์ž์„ธํžˆ ์ฝ์–ด์ฃผ๊ธฐ์˜ ์ง€์นจ์„ ๋”ฐ๋ž๊ณ  ํšŒ์ƒ‰์œผ๋กœ ํ‘œ์‹œ๋œ ์•„์ด์ฝ˜๋งŒ ํ‘œ์‹œํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ท€ํ•˜์˜ ์†”๋ฃจ์…˜์€ ์ฆ‰์‹œ ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค... ์ด์œ ๋ฅผ ์•Œ๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค!

@jskidd3 ๋„์›€์ด ๋˜์—ˆ๋‹ค๋‹ˆ ๋‹คํ–‰์ž…๋‹ˆ๋‹ค! ์ •๋ง ๊ฐ„๋‹จํ•ฉ๋‹ˆ๋‹ค. cordova-custom-config ํ”Œ๋Ÿฌ๊ทธ์ธ์„ ์‚ฌ์šฉํ•˜๋ฉด ๊ฐ ํ”Œ๋žซํผ(Info.plist / AndroidManifest.xml)์— ๋Œ€ํ•œ Cordova์˜ ์ตœ์ข… ๊ตฌ์„ฑ์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ config-file ๋ธ”๋ก์—์„œ Android์šฉ ํ”Œ๋Ÿฌ๊ทธ์ธ ๊ตฌ์„ฑ์— "notification_icon"์ด๋ผ๋Š” ์ƒˆ ์ด๋ฆ„์œผ๋กœ ๋“œ๋กœ์–ด๋ธ” ๋””๋ ‰ํ† ๋ฆฌ์—์„œ "default_notification_icon"์„ ๊ฒ€์ƒ‰ํ•˜๋„๋ก ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค(ํ”Œ๋Ÿฌ๊ทธ์ธ์ด ํŒŒ์ผ ํ™•์žฅ์ž๋ฅผ ์ž˜ ๊ธฐ์–ตํ•œ๋‹ค๋ฉด). ๊ทธ๋Ÿฐ ๋‹ค์Œ ๋‹ค์Œ ๋ธ”๋ก(๋นจ๊ฐ„์ƒ‰)์—์„œ ๋ฐฐ๊ฒฝ์ƒ‰์„ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์ด์ œ ๋นŒ๋“œ ์‹œ๊ฐ„์— ์˜ฌ๋ฐ”๋ฅธ ์œ„์น˜์— ํ•ด๋‹น ํŒŒ์ผ(notification_icon.png)์„ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ๋ฒ•์ด ํ•„์š”ํ•˜๋ฏ€๋กœ ์ด๋ฅผ ์ˆ˜ํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ํ›„ํฌ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๊ฒƒ์€ android_custom_resources.js์ž…๋‹ˆ๋‹ค. resources/android/custom/*์— ์žˆ๋Š” ๋ชจ๋“  ๊ฒƒ์„ ๊ฐ€์ ธ์™€์„œ ๋นŒ๋“œ์˜ ๋“œ๋กœ์–ด๋ธ” ๋””๋ ‰ํ† ๋ฆฌ์— ๋„ฃ์Šต๋‹ˆ๋‹ค(์Šคํฌ๋ฆฝํŠธ๋ฅผ ํŽธ์ง‘ํ•˜์—ฌ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์ด ์ž‘์—…์—์„œ๋Š” ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค). ์ถ”๊ฐ€ ๊ตฌ์„ฑ ์Šคํƒ€์ผ๊ณผ ์œ ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์ด styles.xml ํŒŒ์ผ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์ƒ‰์ƒ์„ ์ •์˜ํ•˜๊ณ (์ €๋Š” ์ด๋ฆ„์„ "๋นจ๊ฐ„์ƒ‰"์œผ๋กœ ์ง€์ •ํ–ˆ์ง€๋งŒ ์›ํ•˜๋Š” ๋Œ€๋กœ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.) android_custom_values.js๋Š” ์ด๋ฅผ ๋นŒ๋“œ๋œ ๋””๋ ‰ํ† ๋ฆฌ "platforms/android/res/values"์— ๋ณต์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋งˆ์ง€๋ง‰์œผ๋กœ config.xml์—์„œ ํŠน์ • ์ˆœ๊ฐ„์— ์‹คํ–‰๋˜๋„๋ก ์ด๋Ÿฌํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋ฐ”์ธ๋”ฉํ•ฉ๋‹ˆ๋‹ค. ์ด ์ž‘์—…์„ ์œ„ํ•ด "after_prepare"๋ฅผ ๋ณต์‚ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ฆ‰, Cordova๊ฐ€ ๋นŒ๋“œ๋ฅผ ์ค€๋น„ํ•œ ํ›„(๋‹ค์‹œ, ์ œ๊ฐ€ ์ž˜ ๊ธฐ์–ตํ•œ๋‹ค๋ฉด... Ionic์˜ ํŒจํ‚ค์ง€ ํ›„ํฌ ๋ฌธ์„œ์—์„œ ์ž์„ธํ•œ ๋‚ด์šฉ/์ด๋ฒคํŠธ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค).

@alexbonhomme ์˜ ๋‹ต๋ณ€์ด ์ €์—๊ฒŒ ํšจ๊ณผ์ ์ด์—ˆ์Šต๋‹ˆ๋‹ค :) https://github.com/arnesson/cordova-plugin-firebase/issues/53#issuecomment -304573222

@shamank ์˜ ๊ฒฐ์ •์€ ๋ถ€๋ถ„์ ์œผ๋กœ ์ €์—๊ฒŒ ํšจ๊ณผ์ ์ž…๋‹ˆ๋‹ค.
Angular + Cordova๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

android_custom_resources.js๋Š” ํด๋”(drawable-ldpi, drawable-mdpi ๋“ฑ)๋ฅผ ์ƒ์„ฑํ•˜์ง€ ์•Š์œผ๋ฉฐ ํด๋”๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ํŒŒ์ผ์„ ๋ณต์‚ฌํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๊ทธ๋ž˜์„œ ํ•ด๋‹น ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  config.xml์—์„œ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ : ๊ฒฝ๋กœ๋Š” ์‚ฌ์šฉ์ž ์ง€์ • ๋ณ€๊ฒฝ ๋ฐ [email protected]์œผ๋กœ ์ธํ•ด ๋‹ค๋ฅผ ์ˆ˜ ์žˆ์œผ๋ฉฐ >์—๋Š” ๋‹ค๋ฅธ ์œ„์น˜์— res/ ํด๋”๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

`

    <resource-file src="res/custom/android/notification.png" target="app/src/main/res/drawable-mdpi/notification.png" />

    <resource-file src="res/custom/android/notification.png" target="app/src/main/res/drawable-hdpi/notification.png" />

    <resource-file src="res/custom/android/notification.png" target="app/src/main/res/drawable-xhdpi/notification.png" />

    <resource-file src="res/custom/android/notification.png" target="app/src/main/res/drawable-xxhdpi/notification.png" />

    <resource-file src="res/custom/android/notification.png" target="app/src/main/res/drawable-xxxhdpi/notification.png" />`

์–ด์จŒ๋“  @alexbonhomme ์™€ @shamank ์—๊ฒŒ ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค!

@shamank ์˜ ์†”๋ฃจ์…˜ ๊ฒฝ๋กœ ๋‚ด๋ถ€์— ์žˆ๋Š” Ionic 3(๋ณด๋‹ค ๊ตฌ์ฒด์ ์œผ๋กœ cordova-android@7์˜ ๊ฒฝ์šฐ)์˜ ๊ฒฝ์šฐ:
package-hooks/android_custom_resources.js package-hooks/android_custom_values.js
res ํด๋”๊ฐ€ ์ง€๊ธˆ platforms/android/app/src/main/ ์•ˆ์— ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ์—…๋ฐ์ดํŠธ๋ฉ๋‹ˆ๋‹ค.

  1. package-hooks/android_custom_resources.js ๋กœ ์ด๋™ํ•˜์—ฌ ์—…๋ฐ์ดํŠธ
    var platformDir = 'platforms/android';
    ์—๊ฒŒ
    var platformDir = 'platforms/android/app/src/main';

  2. package-hooks/android_custom_values.js ๋กœ ์ด๋™ํ•˜์—ฌ ์—…๋ฐ์ดํŠธ
    var platformDir = platforms/android/res/values';
    ์—๊ฒŒ
    var platformDir = 'platforms/android/app/src/main/res/values';

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰