Unable to add shortcuts to desktop from 3rd party apps

Explain your issue here
Post Reply
Wern-YuenTan
Posts: 7
Joined: Sun Jan 27, 2019 3:41 pm

Unable to add shortcuts to desktop from 3rd party apps

Post by Wern-YuenTan » Sun Jan 27, 2019 3:45 pm

Since Android Nougat, I've not been able to use third party apps to add shortcuts to the desktop. It seems the apis for adding shortcuts was updated in Nougat but LL was not updated

Adding shortcuts manually via the lightning user menu still works, though

User avatar
Pierrot
Site Admin
Posts: 181
Joined: Wed Jan 23, 2019 12:18 pm
Location: French Alps

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Pierrot » Sun Jan 27, 2019 4:51 pm

I'm not quite sure that this is an API change, I would rather think at a security measure, but TBH I didn't check yet. Anyway this style of creating shortcuts is becoming deprecated. I think it won't live long.

juwlz
Posts: 19
Joined: Thu Jan 24, 2019 6:51 pm
Location: UK

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by juwlz » Mon Jan 28, 2019 9:36 am

There are some apps (Google Chrome browser is one!) where the app doesn't appear in the list of apps you can create shortcuts for if you add a shortcut from the LL desktop, even though the app has an Add to Home Screen option within the app's own menu. I did try to find a way to add a URL to the desktop instead (so that it would open in my default browser) in LL, but can't find a way to do that either.

Now maybe that's Google's issue to solve (in this case), but a generic "Add URL" option would allow a shortcut to a website to be saved, and let Android prompt for whichever app should open it if there's more than one option.

For that matter, a generic link to a local file would allow the same mechanism to save a shortcut to a particular file associated with any other app - as long as the app itself offers to open its own files, of course.

User avatar
Pierrot
Site Admin
Posts: 181
Joined: Wed Jan 23, 2019 12:18 pm
Location: French Alps

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Pierrot » Mon Jan 28, 2019 9:54 am

It seems the issue also depends on chrome versions: I just checked on my testing oreo device, and the option to add a bookmark on the desktop is gone, so I can't even have a bookmark on my home screen neither :-(

Yes, a generic url shortcut would be the solution, although it may not always work as expected. For instance linking to a particular file is now forbidden :cry: Linking to web urls should still work.

That can be done through scripts also. There may be a ready to use script to do just that but I couldn't find one on https://www.lightninglauncher.com/wiki/ ... repository although it reminds me something. I believe at some point it has been used to manipulate intents of existing shortcuts.

User avatar
TrianguloY
Posts: 107
Joined: Thu Jan 24, 2019 9:46 am

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by TrianguloY » Mon Jan 28, 2019 1:01 pm

All the information I could find is about creating the shortcuts from the apps, not about receiving them from the launcher (I'm sure the information is somewhere, but no luck yet).

Based on my experience, when you use WhatsApp 'add chat to home screen' feature while Lighting is the default launcher, a toast is shown with text 'the shortcut was created' (although it is not).
However when Google launcher is the default launcher, a popup dialog is shown to confirm the action. (See screenshots)
This popup is from the Google app, and when accepting it no toast is shown, and the shortcut is created.

Not sure how third party launchers can 'react' and show a similar dialog, I didn't tried any other launcher.


About scripts: I remember publishing scripts to create shortcuts to web pages, but probably because the script was a few lines long I never published it on the wiki :/
I'll try to do it.

I also have a personal script to see and edit a shortcut intent uri, in fact I remember wanting to publish it, but I didn't liked how it was made. I'll give it another try too.
Attachments
Screenshot_20190127-222239.png
Screenshot_20190127-222239.png (1.09 MiB) Viewed 8922 times
Screenshot_20190127-222219.png
Screenshot_20190127-222219.png (1.05 MiB) Viewed 8922 times

User avatar
Pierrot
Site Admin
Posts: 181
Joined: Wed Jan 23, 2019 12:18 pm
Location: French Alps

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Pierrot » Mon Jan 28, 2019 1:08 pm

OK, bad news. when testing with an emulator, here is the message I got from the android framework in the log:

Code: Select all

ActivityManager: Broadcast com.android.launcher.action.INSTALL_SHORTCUT no longer supported. It will not be delivered.
This explicitly means that apps willing to create shortcuts this way are now muted, and the launcher won't even receive the shortcut. It seems that Google made this change but even Google apps have not all been updated to use the new (and boring) API.

User avatar
PrasadKaladi
Posts: 10
Joined: Sun Jan 27, 2019 4:16 pm

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by PrasadKaladi » Mon Jan 28, 2019 2:22 pm

I'm using this script for Chrome URLs through LLX (which I found on g+ sometime):

Code: Select all

Weblink=LL.getEvent().getData();
var i = new Intent(Intent.ACTION_VIEW);
//i.setData(Uri.parse("https://www.google.co.in"));
i.setData(Uri.parse(Weblink));
try{
LL.startActivity(i);
}catch(anfe){
Android.makeNewToast("Activity not found Exception", true).show();
}
And I've a shortcut to open this script on my desktop.

Hope you can use this as a work around, @juwlz
Prasad :lol:

User avatar
Pierrot
Site Admin
Posts: 181
Joined: Wed Jan 23, 2019 12:18 pm
Location: French Alps

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Pierrot » Mon Jan 28, 2019 5:24 pm

After the bad news, I have good news.

Lightning is not conforming to the newest API, and some apps (like Chrome) detect this and behave in old mode when creating shortcuts (which is quite strange since it can't work anyway).
I patched LL to use the newest Oreo API and was able to add Chrome shortcuts, it works. These shortcuts are however opaque, they are not clear text as before, but that shouldn't be a problem in most cases.

I'll probably update the beta on Wednesday.

User avatar
PrasadKaladi
Posts: 10
Joined: Sun Jan 27, 2019 4:16 pm

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by PrasadKaladi » Mon Jan 28, 2019 5:30 pm

Pierrot wrote:
Mon Jan 28, 2019 5:24 pm
I'll probably update the beta on Wednesday.
That's great. Thank you.
Prasad :lol:

juwlz
Posts: 19
Joined: Thu Jan 24, 2019 6:51 pm
Location: UK

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by juwlz » Tue Jan 29, 2019 8:31 am

Pierrot wrote:
Mon Jan 28, 2019 5:24 pm
I patched LL to use the newest Oreo API and was able to add Chrome shortcuts, it works. These shortcuts are however opaque, they are not clear text as before, but that shouldn't be a problem in most cases.

I'll probably update the beta on Wednesday.
Thanks @Pierrot.
Not sure what you mean by the shortcuts being opaque/not clear text though.

User avatar
TrianguloY
Posts: 107
Joined: Thu Jan 24, 2019 9:46 am

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by TrianguloY » Tue Jan 29, 2019 8:40 am

Pierrot wrote:
Mon Jan 28, 2019 5:24 pm
After the bad news, I have good news.

Lightning is not conforming to the newest API, and some apps (like Chrome) detect this and behave in old mode when creating shortcuts (which is quite strange since it can't work anyway).
I patched LL to use the newest Oreo API and was able to add Chrome shortcuts, it works. These shortcuts are however opaque, they are not clear text as before, but that shouldn't be a problem in most cases.

I'll probably update the beta on Wednesday.
Just out of curiosity: where did you find the information about the changes to make launcher-side? (The official android developer page? Other? When I searched I couldn't find anything, so I'm sure I missed the obvious :? )

User avatar
Pierrot
Site Admin
Posts: 181
Joined: Wed Jan 23, 2019 12:18 pm
Location: French Alps

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Pierrot » Wed Jan 30, 2019 3:53 am

@juwlz , by opaque I mean that the URL is not visible in the shortcut, only some kind of hash/unique id which is only understandable by the app that handles it. It means that you cannot view or modify the thing at which the shortcut is pointing too.

@TrianguloY I looked at the AOSP launcher source code. This is the only documentation I could find. LauncherApps shortcuts are documented on the app side, but not on the launcher side. Fortunately launcher3 can be built out of the android source tree, and it's easy to experiment with the code.

Cueball666uk
Posts: 59
Joined: Tue Jan 29, 2019 7:08 pm

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Cueball666uk » Wed Jan 30, 2019 11:32 am

I just create a Browse URL task in Tasker and add an icon ... Then I can either have a shortcut or can set a gesture ...! I know it's not ideal but it's the easiest way I have found 🙂

ChuckC
Posts: 3
Joined: Tue Jan 29, 2019 8:46 pm

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by ChuckC » Wed Jan 30, 2019 3:05 pm

Pierrot, Thanks for update, bookmark to home screen works well again.

Wern-YuenTan
Posts: 7
Joined: Sun Jan 27, 2019 3:41 pm

Re: Unable to add shortcuts to desktop from 3rd party apps

Post by Wern-YuenTan » Thu Jan 31, 2019 2:35 pm

Thanks Pierre, works perfectly for me now since the last update

Post Reply