关于launcher3 应用icon会自动添加到待机页面的问题
2017-04-14 15:44
387 查看
在android系统开发过程中。发现有些应用在安装后,在主菜单中第一次进入之后,此应用的icon会自动加载到待机页面上。
通过launcher3源码发现。
在AndroidManifest.xml中
launcher3 静态注册了 com.android.launcher.action.INSTALL_SHORTCUT 广播。
有些应用,如微信等在第一次进入后,会想系统发上面的广播。
launcher3 在接收到此广播后会将此icon加载到待机页面。
通过launcher3源码发现。
在AndroidManifest.xml中
<!-- Intent received used to install shortcuts from other applications --> <receiver android:name="com.android.launcher3.extension.MockInstallShortcutReceiver" android:permission="com.android.launcher.permission.INSTALL_SHORTCUT"> <intent-filter> <action android:name="com.android.launcher.action.INSTALL_SHORTCUT" /> </intent-filter> </receiver>
launcher3 静态注册了 com.android.launcher.action.INSTALL_SHORTCUT 广播。
有些应用,如微信等在第一次进入后,会想系统发上面的广播。
launcher3 在接收到此广播后会将此icon加载到待机页面。
public class InstallShortcutReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent data) { if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) { return; } PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, context); if (info.launchIntent == null || info.label == null) { if (DBG) Log.e(TAG, "Invalid install shortcut intent"); return; } info = convertToLauncherActivityIfPossible(info); queuePendingShortcutInfo(info, context); } }
相关文章推荐
- 关于gulp中自动添加版本号及Html文件应用路径替换的问题
- 关于页面自动提交两次的问题(360浏览器)
- Android 开发之系统应用Launcher详解,简单添加和删除快捷方式及常见问题
- jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法
- 关于button按钮自动提交表单刷新页面问题
- 关于Unity打Android包自动添加权限的问题
- 关于jquery页面自动跳转的问题
- 关于页面自动提交两次的问题(360浏览器)
- unity 关于添加自动导航NavMeshAgent后模型动画的抖动问题
- jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法
- 关于scr自动添加到eclipse工程的包名中的问题
- jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法
- 关于页面自动刷新问题!
- 关于在c#中创建用户控件后,winform应用程序在调用中无法通过点击用户控件的子控件为其自动添加事件代码的问题
- 关于端口做过映射导致nginx自动添加内网端口的问题
- 关于js自动添加input元素的一个问题
- jQuery EasyUI动态添加控件或者ajax加载页面后不能自动渲染问题的解决方法
- 关于QT中自动添加槽函数编译出错的问题