Strange app icon duplication in pinned shortcut (Android O)











up vote
2
down vote

favorite
1












I'm creating a pinned shortcut of my app launcher icon for Android O device (either emulator or physical device) and found strange behaviour. My code looks like this:



@TargetApi(Build.VERSION_CODES.O)
private void createPinnedShortcut(Context context) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
if (shortcutManager != null) {
if (shortcutManager.isRequestPinShortcutSupported()) {
Intent intent= MainActivity.getLaunchIntent(this);
intent.setAction(Intent.ACTION_VIEW);

ShortcutInfo shortcut = new ShortcutInfo.Builder(context, "my_shortcut_id")
.setShortLabel(context.getString(R.string.my_app_description))
.setLongLabel(context.getString(R.string.my_app_long_description))
.setIcon(Icon.createWithResource(context, R.mipmap.my_app_icon))
.setIntent(intent)
.build();
shortcutManager.requestPinShortcut(shortcut, null);
} else
Toast.makeText(context, "Pinned shortcuts are not supported!", Toast.LENGTH_SHORT).show();
}
}


Everything works, but the launcher icon on the home screen is duplicated:



app launcher icon



There is a normal icon, but on right lower corner it placed yet another copy of the icon (about 30-40% smaller).



My icon resources are in res/mipmap-*dpi* folders



Any hints, clues?



Update



Answering to comments:



1) AndroidManifest under ./build/manifests/debug looks like:



    <activity
android:name="ru.ivanovpv.cellboxkeeper.android.MainActivity"
android:exported="true"
android:label="@string/cellboxkeeper"
android:theme="@style/DefaultActivityTheme.Light"
android:windowSoftInputMode="adjustResize" >
<layout
android:defaultHeight="800dp"
android:defaultWidth="480dp"
android:gravity="top|end"
android:minHeight="320dp"
android:minWidth="240dp" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> <!-- handle cbx files -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/cellboxkeeper"
android:logo="@mipmap/cellboxkeeper" >
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\.cbx"
android:scheme="content" />
</intent-filter>
<!-- receive files from android share intent -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/addToCellboxKeeper" >
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


2) There's not any folder like: mipmap-*-v26. Here's screenshot of folders in real apk. All icons in folders are normal (w/o duplication).



folders



Any other versions?










share|improve this question
























  • Could u please check the file "./build/manifests/debug/AndroidManifest.xml" and see how many times intent-filter tags are defined, should have only been defined in your main activity. Should be like: ..."android.intent.action.MAIN" />
    – Eray Balkanli
    Nov 11 at 0:01












  • Please share content of mipmap-anydpi-v26 directory.
    – aminography
    Nov 11 at 5:08










  • Please read update of question
    – barmaley
    Nov 11 at 19:42















up vote
2
down vote

favorite
1












I'm creating a pinned shortcut of my app launcher icon for Android O device (either emulator or physical device) and found strange behaviour. My code looks like this:



@TargetApi(Build.VERSION_CODES.O)
private void createPinnedShortcut(Context context) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
if (shortcutManager != null) {
if (shortcutManager.isRequestPinShortcutSupported()) {
Intent intent= MainActivity.getLaunchIntent(this);
intent.setAction(Intent.ACTION_VIEW);

ShortcutInfo shortcut = new ShortcutInfo.Builder(context, "my_shortcut_id")
.setShortLabel(context.getString(R.string.my_app_description))
.setLongLabel(context.getString(R.string.my_app_long_description))
.setIcon(Icon.createWithResource(context, R.mipmap.my_app_icon))
.setIntent(intent)
.build();
shortcutManager.requestPinShortcut(shortcut, null);
} else
Toast.makeText(context, "Pinned shortcuts are not supported!", Toast.LENGTH_SHORT).show();
}
}


Everything works, but the launcher icon on the home screen is duplicated:



app launcher icon



There is a normal icon, but on right lower corner it placed yet another copy of the icon (about 30-40% smaller).



My icon resources are in res/mipmap-*dpi* folders



Any hints, clues?



Update



Answering to comments:



1) AndroidManifest under ./build/manifests/debug looks like:



    <activity
android:name="ru.ivanovpv.cellboxkeeper.android.MainActivity"
android:exported="true"
android:label="@string/cellboxkeeper"
android:theme="@style/DefaultActivityTheme.Light"
android:windowSoftInputMode="adjustResize" >
<layout
android:defaultHeight="800dp"
android:defaultWidth="480dp"
android:gravity="top|end"
android:minHeight="320dp"
android:minWidth="240dp" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> <!-- handle cbx files -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/cellboxkeeper"
android:logo="@mipmap/cellboxkeeper" >
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\.cbx"
android:scheme="content" />
</intent-filter>
<!-- receive files from android share intent -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/addToCellboxKeeper" >
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


2) There's not any folder like: mipmap-*-v26. Here's screenshot of folders in real apk. All icons in folders are normal (w/o duplication).



folders



Any other versions?










share|improve this question
























  • Could u please check the file "./build/manifests/debug/AndroidManifest.xml" and see how many times intent-filter tags are defined, should have only been defined in your main activity. Should be like: ..."android.intent.action.MAIN" />
    – Eray Balkanli
    Nov 11 at 0:01












  • Please share content of mipmap-anydpi-v26 directory.
    – aminography
    Nov 11 at 5:08










  • Please read update of question
    – barmaley
    Nov 11 at 19:42













up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





I'm creating a pinned shortcut of my app launcher icon for Android O device (either emulator or physical device) and found strange behaviour. My code looks like this:



@TargetApi(Build.VERSION_CODES.O)
private void createPinnedShortcut(Context context) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
if (shortcutManager != null) {
if (shortcutManager.isRequestPinShortcutSupported()) {
Intent intent= MainActivity.getLaunchIntent(this);
intent.setAction(Intent.ACTION_VIEW);

ShortcutInfo shortcut = new ShortcutInfo.Builder(context, "my_shortcut_id")
.setShortLabel(context.getString(R.string.my_app_description))
.setLongLabel(context.getString(R.string.my_app_long_description))
.setIcon(Icon.createWithResource(context, R.mipmap.my_app_icon))
.setIntent(intent)
.build();
shortcutManager.requestPinShortcut(shortcut, null);
} else
Toast.makeText(context, "Pinned shortcuts are not supported!", Toast.LENGTH_SHORT).show();
}
}


Everything works, but the launcher icon on the home screen is duplicated:



app launcher icon



There is a normal icon, but on right lower corner it placed yet another copy of the icon (about 30-40% smaller).



My icon resources are in res/mipmap-*dpi* folders



Any hints, clues?



Update



Answering to comments:



1) AndroidManifest under ./build/manifests/debug looks like:



    <activity
android:name="ru.ivanovpv.cellboxkeeper.android.MainActivity"
android:exported="true"
android:label="@string/cellboxkeeper"
android:theme="@style/DefaultActivityTheme.Light"
android:windowSoftInputMode="adjustResize" >
<layout
android:defaultHeight="800dp"
android:defaultWidth="480dp"
android:gravity="top|end"
android:minHeight="320dp"
android:minWidth="240dp" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> <!-- handle cbx files -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/cellboxkeeper"
android:logo="@mipmap/cellboxkeeper" >
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\.cbx"
android:scheme="content" />
</intent-filter>
<!-- receive files from android share intent -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/addToCellboxKeeper" >
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


2) There's not any folder like: mipmap-*-v26. Here's screenshot of folders in real apk. All icons in folders are normal (w/o duplication).



folders



Any other versions?










share|improve this question















I'm creating a pinned shortcut of my app launcher icon for Android O device (either emulator or physical device) and found strange behaviour. My code looks like this:



@TargetApi(Build.VERSION_CODES.O)
private void createPinnedShortcut(Context context) {
ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
if (shortcutManager != null) {
if (shortcutManager.isRequestPinShortcutSupported()) {
Intent intent= MainActivity.getLaunchIntent(this);
intent.setAction(Intent.ACTION_VIEW);

ShortcutInfo shortcut = new ShortcutInfo.Builder(context, "my_shortcut_id")
.setShortLabel(context.getString(R.string.my_app_description))
.setLongLabel(context.getString(R.string.my_app_long_description))
.setIcon(Icon.createWithResource(context, R.mipmap.my_app_icon))
.setIntent(intent)
.build();
shortcutManager.requestPinShortcut(shortcut, null);
} else
Toast.makeText(context, "Pinned shortcuts are not supported!", Toast.LENGTH_SHORT).show();
}
}


Everything works, but the launcher icon on the home screen is duplicated:



app launcher icon



There is a normal icon, but on right lower corner it placed yet another copy of the icon (about 30-40% smaller).



My icon resources are in res/mipmap-*dpi* folders



Any hints, clues?



Update



Answering to comments:



1) AndroidManifest under ./build/manifests/debug looks like:



    <activity
android:name="ru.ivanovpv.cellboxkeeper.android.MainActivity"
android:exported="true"
android:label="@string/cellboxkeeper"
android:theme="@style/DefaultActivityTheme.Light"
android:windowSoftInputMode="adjustResize" >
<layout
android:defaultHeight="800dp"
android:defaultWidth="480dp"
android:gravity="top|end"
android:minHeight="320dp"
android:minWidth="240dp" />

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter> <!-- handle cbx files -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/cellboxkeeper"
android:logo="@mipmap/cellboxkeeper" >
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="*"
android:mimeType="*/*"
android:pathPattern=".*\.cbx"
android:scheme="content" />
</intent-filter>
<!-- receive files from android share intent -->
<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/addToCellboxKeeper" >
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>


2) There's not any folder like: mipmap-*-v26. Here's screenshot of folders in real apk. All icons in folders are normal (w/o duplication).



folders



Any other versions?







java android icons shortcut android-8.0-oreo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 at 0:34









Mozahler

2,03841625




2,03841625










asked Nov 8 at 14:14









barmaley

12k1562122




12k1562122












  • Could u please check the file "./build/manifests/debug/AndroidManifest.xml" and see how many times intent-filter tags are defined, should have only been defined in your main activity. Should be like: ..."android.intent.action.MAIN" />
    – Eray Balkanli
    Nov 11 at 0:01












  • Please share content of mipmap-anydpi-v26 directory.
    – aminography
    Nov 11 at 5:08










  • Please read update of question
    – barmaley
    Nov 11 at 19:42


















  • Could u please check the file "./build/manifests/debug/AndroidManifest.xml" and see how many times intent-filter tags are defined, should have only been defined in your main activity. Should be like: ..."android.intent.action.MAIN" />
    – Eray Balkanli
    Nov 11 at 0:01












  • Please share content of mipmap-anydpi-v26 directory.
    – aminography
    Nov 11 at 5:08










  • Please read update of question
    – barmaley
    Nov 11 at 19:42
















Could u please check the file "./build/manifests/debug/AndroidManifest.xml" and see how many times intent-filter tags are defined, should have only been defined in your main activity. Should be like: ..."android.intent.action.MAIN" />
– Eray Balkanli
Nov 11 at 0:01






Could u please check the file "./build/manifests/debug/AndroidManifest.xml" and see how many times intent-filter tags are defined, should have only been defined in your main activity. Should be like: ..."android.intent.action.MAIN" />
– Eray Balkanli
Nov 11 at 0:01














Please share content of mipmap-anydpi-v26 directory.
– aminography
Nov 11 at 5:08




Please share content of mipmap-anydpi-v26 directory.
– aminography
Nov 11 at 5:08












Please read update of question
– barmaley
Nov 11 at 19:42




Please read update of question
– barmaley
Nov 11 at 19:42












1 Answer
1






active

oldest

votes

















up vote
3
down vote



accepted










I found solution, key is attribute android:logo:



<intent-filter
android:icon="@mipmap/cellboxkeeper"
android:label="@string/cellboxkeeper"
android:logo="@mipmap/cellboxkeeper" >
<action android:name="android.intent.action.VIEW" />


Deleting line with android:logo fixes duplication issue.



Hope, someone and sometimes will use and understands what's goin on






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53209552%2fstrange-app-icon-duplication-in-pinned-shortcut-android-o%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote



    accepted










    I found solution, key is attribute android:logo:



    <intent-filter
    android:icon="@mipmap/cellboxkeeper"
    android:label="@string/cellboxkeeper"
    android:logo="@mipmap/cellboxkeeper" >
    <action android:name="android.intent.action.VIEW" />


    Deleting line with android:logo fixes duplication issue.



    Hope, someone and sometimes will use and understands what's goin on






    share|improve this answer

























      up vote
      3
      down vote



      accepted










      I found solution, key is attribute android:logo:



      <intent-filter
      android:icon="@mipmap/cellboxkeeper"
      android:label="@string/cellboxkeeper"
      android:logo="@mipmap/cellboxkeeper" >
      <action android:name="android.intent.action.VIEW" />


      Deleting line with android:logo fixes duplication issue.



      Hope, someone and sometimes will use and understands what's goin on






      share|improve this answer























        up vote
        3
        down vote



        accepted







        up vote
        3
        down vote



        accepted






        I found solution, key is attribute android:logo:



        <intent-filter
        android:icon="@mipmap/cellboxkeeper"
        android:label="@string/cellboxkeeper"
        android:logo="@mipmap/cellboxkeeper" >
        <action android:name="android.intent.action.VIEW" />


        Deleting line with android:logo fixes duplication issue.



        Hope, someone and sometimes will use and understands what's goin on






        share|improve this answer












        I found solution, key is attribute android:logo:



        <intent-filter
        android:icon="@mipmap/cellboxkeeper"
        android:label="@string/cellboxkeeper"
        android:logo="@mipmap/cellboxkeeper" >
        <action android:name="android.intent.action.VIEW" />


        Deleting line with android:logo fixes duplication issue.



        Hope, someone and sometimes will use and understands what's goin on







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 at 6:55









        barmaley

        12k1562122




        12k1562122






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53209552%2fstrange-app-icon-duplication-in-pinned-shortcut-android-o%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()