Hi

Hi,

I’m looking for help.

I would like to create shortcuts to my recent contacts in a script. Using tasker and AutoContact, I’m able to build a JSON array containing the contact ID and contact name of the 10 last recent contacts.

The goal is to iterate this JSON array in a script that would build a list of shortcuts to open these contacts and add them in a Panel.

Part of the script I’m using to create the shortcut based on the contact ID:

var contactID = “207”; //to be iterated

var contactName = “My Contact”; //to be iterated

var intent = Intent.parseUri(“content://com.android.contacts/contacts/” + contactID + “#Intent;action=android.provider.action.QUICK_CONTACT;type=vnd.android.cursor.item/contact;launchFlags=0x10018000;B.com.android.launcher.intent.extra.shortcut.INGORE_LAUNCH_ANIMATION=true;end”,0);

var addedShortcut = myPanel.getContainer().addShortcut(contactName ,intent,0,0);

It works fine: the shortcut is created and it opens the contact but I need help to retrieve the icon that corresponds to the contact: sometimes it is a picture, somtimes it is a material icon representing the first letter of the contact name. Any idea how I could achieve this ?

Any hint/idea is welcome!

]]>

5 Commentsto Hi

  1. Anonymous says:

    < ![CDATA[

    Thanks for the reply.


    Unfortunately, I have very limited knowledge in Android development and I will not be able to find the solution by myself without a concrete example.



    I googled it and could not find an example that I could use in lightning launcher. Do you know where I could find some code that would just need some little update to fit my needs ?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Stany Freres Lightning requires java code written in javascript. This is a unique combination afaik. You’ll find no help except in directly LL related resources. I’ll see if I can put an example together.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    Thanks for this reply!


    In the meantime, I already found a workaround that works pretty well: if the contact has a picture, I extract it with AutoContact in Tasker. If there is no picture, I use the first letter of the contact name to link it to a rounded letter icon. The result is quite nice and looks a lot like the real icon !

    ]]>

  4. Anonymous says:

    < ![CDATA[

    Good to know. I’ve had no success setting up a lighting-exclusive solution for this, so your workaround seems to be the way to go

    ]]>

Leave a Reply to Anonymous Cancel reply

Your email address will not be published. Required fields are marked *