Sujet : Re: How to make custom one-tap shortcuts to phone numbers in Android
De : marion (at) *nospam* facts.com (Marion)
Groupes : comp.mobile.androidDate : 27. Apr 2025, 08:42:19
Autres entêtes
Organisation : BWH Usenet Archive (https://usenet.blueworldhosting.com)
Message-ID : <vukn4q$1k8n$1@nnrp.usenet.blueworldhosting.com>
References : 1
User-Agent : Alan Baker insisted this line can not be changed
On Sun, 27 Apr 2025 07:06:04 -0000 (UTC), Marion wrote :
Where I think billions of people could benefit if we, together, as a team,
can write up a tutorial for how anyone on Android can create a one-tap
shortcut that dials any given person, where they can put those shortcuts
into a homescreen folder, perhaps with their photo as the shortcut icon.
Since the need is so obvious, the first quest in creating a one-tap
shortcut to any phone number would be to search to see who has done it.
<
https://google.com/search?q=%2BIntenet+%2BAndroid+-Widget+%22how+to+add+direct-dial%22+%2Bshortcut>
Most of the hits confuse a Widget with a Shortcut unfortunately.
In fact, almost everything confuses a Widget with a Shortcut.
It's crazy. The search results are utterly useless as a result.
I looked at scores of hits, but so far I can't find much on this.
This may be promising as it uses a method I wouldn't have thought of.
<
https://developer.android.com/develop/ui/views/launch/shortcuts/creating-shortcuts>
Specifically the section on "Create pinned shortcuts"
<
https://developer.android.com/develop/ui/views/launch/shortcuts/creating-shortcuts#pinned>
That's for developers, but maybe it gives us the syntax we need?
1. Create shortcuts.xml in your app's res/xml directory.
2. Within the XML file, define the shortcut's title, icon,
and the intent that will be triggered when the shortcut
is tapped. The intent should be an intent to launch the
dialer with the phone number of the desired contact.
3. Ensure your app includes the necessary dependencies
for the Google Shortcuts Integration Library and
for ShortcutManagerCompat.
The code below demonstrates how to create an intent
to dial a phone number programmatically:
Intent callIntent = new
Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:" + phoneNumber));
startActivity(callIntent);
Given people don't know the difference between a widget and a shortcut, a
search isn't working like it should be working, at least not for me.
I'll have to run some empirical tests, where Intents are, I think, the only
way to go, but I'm hoping to find SOMEONE on the planet who is ahead of us.