Android built-in desktop icon link URL

Source: Internet
Author: User

Reference URL: http://www.lanfox.com/forum.php? MoD = viewthread & tid = 2354.

Keywords: Android desktop shortcut plug-in URL Creation
Platform: s5pv310 System: android2.3 android2.3.4 android4.0.3


Problem:

Today, I have a customer who asked me to create an icon on the desktop and click link to their company's website. I have used application shortcuts before and put them on the desktop by default, such as creating Desktop shortcuts and plug-ins for Android, you have not done any previous URLs.

Considerations:

(1) make a small application, call the system browser, and write a fixed website address;

(2) Add the URL to the desktop default value.

Obviously, the second solution is simpler. You can find this method on the Internet as follows:

I. Read the desktop icon

/Packages/apps/launcher/RES/XML/Default_workspace.xmlThe desktop marker arrangement is recorded when the system initializes or restores the factory settings. After the launcher program runs for the first time, it creates a record in/data/COM. Android. launcher/databases/launcher. DB, which contains all the current desktop icons. In the future, the desktop icon will only be read from here at each startup.

Ii. default_workspace.xml Analysis
Default_workspace.xmlSupported labels:
Favorite:Application shortcuts.
Shortcut:Links, such as URLs and local disk paths.
Search:Search box.
Clock:Watch widget on the desktop
Supported attributes include::
Launcher: Title:Text under the icon. Currently, only references are supported. Strings cannot be written directly;
Launcher: icon:Icon reference;
Launcher: URI:Link address. This is the main character.
Launcher: packagename:Package name of the application;
Launcher: classname: The startup Class Name of the application;
Launcher: screen:The number of the screen where the icon is located;
Launcher: X:The serial number of the icon in the horizontal arrangement;
Launcher: Y:The serial number of the icon in the vertical arrangement;

The loadfavorites method in launcherprovider. Java is responsible for parsing.

Iii. Solutions for Network Connections

Write the application,Default_workspace.xmlThere are a lot of links, but there is no way to write them. I analyzed its parsing program and reversed the link Shortcut method. It has been verified successfully and I hope it will help you.

<shortcut        launcher:title="@string/baidu"        launcher:icon="@drawable/baidu"        launcher:uri="http://www.baidu.com"        launcher:screen="1"        launcher:x="0"        launcher:y="3" />

The icon content and text content of the link areDefault_workspace.xml.
The application's icon content and text content under the icon are obtained from packagemanager.
If the package name and Class Name of the application are not found in packagemanager for some reason at launcher startup, the desktop will not display its icon. If the class name and package name are found but the icon is not found, the default robot icon for Android is displayed.
ThereforeDefault_workspace.xmlWhen adding a spindle, you only need to write the title, icon, Uri, screen, X, and y attributes.
To add an application, you only need to write the attributes packagename, classname, screen, X, and Y.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.