3

In Android O new pinned shortcuts API has been introduced. In additional they simple block old way (via "com.android.launcher.action.INSTALL_SHORTCUT" action).

At the end this API works but new pinned shortcut icons have app icon at the bottom right. I.e. you provide some icon in the API, but the final shortcut icon on the launcher have in additional app icon.

I know that this was added specially for inform the user which app has created the shortcut.

But is there any way for remove this icon and show icon which I provide in ShortcutManager.requestPinShortcut (ShortcutInfo shortcut,IntentSender resultIntent) ?

Update 1
Many users of my app think that I do this specially (and some users even try to buy Pro mode for disable this). So I really want to find any possible workarounds, as I understand from Oreo source code - this happens because a launcher app requests shortcut icon with the badge. So valid fix can be made only on launcher side only.
I also tried to cheat system function for obtain shortcut icon with the badge - while you use requestPinShortcut the system adds your app id automatically to the shortcut info, I tried to avoid this and provide 0 instead of valid app id, but seems somewhere on low level this is blocked and creating of a shortcuts is not happen.
Another try: setup the app icon to transparent, so this works, but don't look cool (your app icon is empty). So I tried to create separate app without main activity but with empty app icon - in this case the system crashes :)

At the end I can find only one workaround - if the user add shortcut not in the app, but via add from widgets flow then the shortcut icon is not changed. I provided this solution to my users.

Alex Tern
  • 96
  • 5
  • Got any solution? – Arnav M. Jun 02 '18 at 07:13
  • 1
    @ArnavM. I spent big amount of time for resolve this issue. But seems Google also worked on this very well - so could not find any workarounds. Actually Launcher app uses special API for obtain the icon, in many cases it requests shortcut icon with the app icon. So it can request without this addition, but I many popular lauchers do not do this. One possible thing - you can use transparent icon for your app (don't think that you will like it). Also I tried to create separate package without main activity but with transparent app icon - in this case system crashes. – Alex Tern Jun 04 '18 at 14:51
  • I have the same issue ,but I Wondered the " “Clean master" App can do this Shortcut creation ,its icon comes normally in Android Oreo – Bivin OC Jun 13 '18 at 05:05
  • @BvnBI which flow creates the shortcut? I could not find it, there is some flow for create widget in Phone Boost settings, but this is widget and not a shortcut. Also I try to decompile this app and it uses normal way via com.android.launcher.action.INSTALL_SHORTCUT for add shortcut on older platforms and some reflections methods on Android O, but at the end this is the same ShortcutManager.requestPinShortcut which generates the same issue. – Alex Tern Jun 13 '18 at 09:00
  • @AlexTern I tried three ways which support Android Oreo that is Dynamic ,Static and Pinned shortcuts , but only pinned comes in home screen , but the same case I checked "Clean master App " its comes normal and neat shortcut on the home screen , Its not widget because we cant launch widget grammatically in home screen , The home screen can only launch widget on the home screen . I think the "Clean master" team follow some other method , I'm still stuck with this issue now . – Bivin OC Jun 13 '18 at 10:13

0 Answers0