通过ADB在创建快捷方式的Andr​​oid [英] Creating shortcuts in Android via ADB

查看:1667
本文介绍了通过ADB在创建快捷方式的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能在我的Andr​​oid的启动创建ADB快捷方式?
我有一个.bat文件来安装从我的电脑我的应用程序(通过双击),但毕竟这我需要始终以巨大的(不那么用户友好的)应用程序启动器列表中搜索。如果有可能将此功能添加到我的.bat文件将是巨大的。
我已经尝试在网络上搜索没有任何运气:S。

It is possible to create a shortcut from ADB on the launcher of my android? I have a .bat file to install my applications from my PC (through double click), but after this I need always to search on the huge (not so user friendly) applications list of the launcher. If it was possible to add this feature to my .bat file would be great. I already try to search on the web without any luck :S.

在此先感谢

推荐答案

有一对夫妇的方式来处理这个问题。如果你的主要需要的是能够快速启动应用程序每次做了重新编辑,那么亚行外壳上午意图-n com.example.app/.App是最简单的解决方案。

There's a couple of ways to handle this. If your main need is to be able to start your application quickly each time you do a re-edit, then an adb shell am intent -n com.example.app/.App is the easiest solution.

如果你只想做一个快捷方式(你不在乎)使用 com.android.launcher.action.INSTALL_SHORTCUT 为大家说。你需要一个应用程序或者彬做,由于AM广播不会采取嵌套的意图。

If you want to just make a shortcut (and you don't care where) use com.android.launcher.action.INSTALL_SHORTCUT as everyone says. You'll need an app or bin to do that as the am broadcast won't take nested intents.

如果您正在使用一个特定的发射器(如ADW Launcher)中工作,就可以破解快捷方式的数据库。这将允许您指定快捷键的坐标([2,3]在这种情况下)

If you are working with a specific launcher (like ADW Launcher) you can hack the database of shortcuts. This will allow you to specify the coordinates of the shortcut ([2, 3] in this case)

adb shell sqlite3 /data/data/org.adw.launcher/databases/launcher.db "DELETE FROM favorites WHERE _id=1; INSERT INTO favorites VALUES(1,'MyApp','#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.example.app/.App;end',-100,0,2,3,1,1,0,-1,NULL,0,NULL,NULL,NULL,NULL,NULL);"

您需要告诉启动程序从数据库刷新。通常情况下,唯一的办法就是杀死发射器。上午的后续版本(在ActivityManager shell命令),有一个重新封装选择,早期版本没有。在这种情况下,你需要写一个小的应用程序:

You'll need to tell the launcher to refresh from the database. Usually the only way is to kill the launcher. Later versions of am (the ActivityManager shell command) have options for restarting a package, earlier versions don't. In that case you'd need to write a small app:

ActivityManager am = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
am.restartPackage("org.adw.launcher");

这篇关于通过ADB在创建快捷方式的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆