Strange app icon duplication in pinned shortcut (Android O)
up vote
2
down vote
favorite
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:
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).
Any other versions?
java android icons shortcut android-8.0-oreo
add a comment |
up vote
2
down vote
favorite
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:
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).
Any other versions?
java android icons shortcut android-8.0-oreo
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 ofmipmap-anydpi-v26
directory.
– aminography
Nov 11 at 5:08
Please read update of question
– barmaley
Nov 11 at 19:42
add a comment |
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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:
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).
Any other versions?
java android icons shortcut android-8.0-oreo
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:
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).
Any other versions?
java android icons shortcut android-8.0-oreo
java android icons shortcut android-8.0-oreo
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 ofmipmap-anydpi-v26
directory.
– aminography
Nov 11 at 5:08
Please read update of question
– barmaley
Nov 11 at 19:42
add a comment |
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 ofmipmap-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
add a comment |
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
add a comment |
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
add a comment |
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
add a comment |
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
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
answered Nov 13 at 6:55
barmaley
12k1562122
12k1562122
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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