Examples and implementations of scenarios where Android app does not display icons on the desktop after installation

Source: Internet
Author: User

Recently in the company to do a car networking products, because the company itself specializes in automotive decoder research and development, so the realization of the product's diagnostic function in addition to the use of the current market access to a large number of network products used in the OBD protocol, will also use some special car special protocol to achieve some specific diagnostic functions, such as window window, maintenance zero, Read the TPMS data stream and so on. The idea of the company is to provide these special-purpose diagnostics as a paid service to the user, that is, the user in the free use of the OBD protocol-based diagnostic functions, if you want to use the special car-specific protocol to achieve a particular feature will need to pay per function how much money (I do not quite agree with this way to make money, Feel free to be good).

I am mainly responsible for this car networking products in the development of Android app, for the implementation of the above mentioned product requirements, we are prepared to each car's special function diagnostic procedures to make a sub-program, that is, a child apk, the reason for choosing such a way, because: ① currently on the market many models, each model corresponding to the same special function of the diagnostic program because the car agreement is different, if all the procedures are placed in an app, will inevitably cause the app too big, late also not good maintenance ② offers these special features in order to cater for the needs of professional car maintenance personnel and vehicle modification enthusiasts (hereinafter referred to as "professional users"), most of which are unlikely to be used by most ordinary users, which makes it easier for users to download.

In order to not allow users to install the child apk after the user's desktop is all kinds of icons (I hate the mobile desktop is too messy), the experience is too poor and let the program's entrance can also focus on the main apk, only to find ways to use some tips on the desktop do not display these icons. The specific implementation is as follows:

1, the development of a opennoiconapp.apk called the main app, inside a button to open the sub-app after clicking, the core jump code is as follows:
public void onClick(View view) {    switch (view.getId()) {    case R.id.btn_open_app:         /*         * Intent intent = getPackageManager().getLaunchIntentForPackage(         * "com.example.noicontest"); if (intent != null) { //         * startActivity(intent); } else {          * Toast.makeText(getApplicationContext(), "没有该子APP,请下载安装",         * Toast.LENGTH_LONG).show(); }         */        Intent intent = new Intent();        ComponentName cn = new ComponentName("com.example.noiconapp","com.example.noiconapp.MainActivity");        intent.setComponent(cn);        intent.setAction("android.intent.action.MAIN");        try {            startActivityForResult(intent, RESULT_OK);        } catch (Exception e) {            Toast.makeText(this, "没有该子APP,请下载安装",Toast.LENGTH_SHORT).show();        }        break;    default:        break;    }}
2, the development of the noiconapp.apk name of the child app (for the main app to open), the app is mainly implemented on the desktop does not display icons. If you want to not display the desktop icon only need to modify the Androidmanifest.xml file. Specific as follows:
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"package="com.example.noiconapp"android:versionCode="1"android:versionName="1.0" ><uses-sdk    android:minSdkVersion="14"    android:targetSdkVersion="14" /><application    android:allowBackup="true"    android:icon="@drawable/ic_launcher"    android:label="@string/app_name"    android:theme="@style/AppTheme" >    <activity        android:name="com.example.noiconapp.MainActivity"        android:label="@string/app_name" >        <intent-filter>            <action android:name="android.intent.action.MAIN" />            <!-- 要想在桌面不显示图标,只需注释掉APP入口Activity中的下面这句即可,或者把下面的LAUNCHER改成DEFAULT也行 -->            <!-- <category android:name="android.intent.category.LAUNCHER" /> -->        </intent-filter>    </activity></application></manifest>
3, the above settings can make the desktop icon does not display the reason:

In general, when our apk is installed, the system will automatically create our APK program, System Launcher (System desktop application) will automatically detect the system has installed the application software package name, and then the app's icon and name resolved to appear in the application list, Once we set the APK icon to not appear as above, the APK program will only appear in the "Running" list of programs after running, instead of displaying the icon and name on the desktop. If you just set the app icon to be invisible and use the first way (the code I commented on) to open the app, it won't be successful, because after this setting, the package name is not loaded to launcher at all, so through Getpackagemanager (). The Getlaunchintentforpackage () method obtains a intent of NULL.

4. Other examples:

A few days ago to update the Unicom "mobile Application Hall" version of the latest Android app, found that the new "network speed" function is actually a sub-app, is the use of this way.

5. Sample program:

Click Download.

Examples and implementations of scenarios where Android app does not display icons on the desktop after installation

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.