我在想,是否有办法在android中的快速设置面板中添加一个项目?我有一个名为Mirror的由Koushik开发的应用,它也是这样做的。它在“快速设置”面板中添加一项。我对应用程序进行了分解,并看到他正在将apk移动到/system/priv-app。就这样。与在“快速设置”中添加项无关。我知道这需要根访问(只是一个大学项目)。如果有人知道怎么做的话,这将是非常有帮助的。
发布于 2014-03-15 14:52:38
Koushik没有添加新的快速设置瓷砖。“强制屏幕”-Tile由android系统实现,有时还会出现。它是系统设置中“强制屏幕”-menu的快捷方式。Koush为这个菜单添加了新的选项(我不知道是否有一个开放的api,或者他是否需要根权限),现在,瓷砖总是显示出来,因为总是有内容。
要回答您的问题:不,如果没有使用root的系统修改,您就不能在android快速设置中添加tiles。(编辑:我还没读到你也会使用根。因此,您不能轻松地添加tiles,而Koushik的镜像应用程序也不能这样做。)
PS:这并不是因为CyanogenMod,因为我使用的是安卓股票,而且这个应用程序也能工作。
更新2019-08-08:使用Android的,有一个官方的API来添加定制的快速设置块(参见山姆的回答)。
发布于 2016-04-09 03:15:31
使用Android平铺API
可以使用瓷砖API在Android中创建自定义快速设置。只需创建一个从TileService继承的类并将其添加到清单中即可。
下面是TileService文档中给出的示例:
<service
android:name=".MyQSTileService"
android:label="@string/my_default_tile_label"
android:icon="@drawable/my_default_icon_label"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter>
</service>发布于 2015-07-14 11:26:16
最近版本的CyanogenMod 12.1通过CyanogenMod平台SDK支持这一点
public void publishTile() {
if (supportsCustomTiles()) {
Intent receiver = new Intent(context, TileClickedReceiver.class);
PendingIntent clickIntent = PendingIntent.getBroadcast(
context,
0,
receiver,
PendingIntent.FLAG_CANCEL_CURRENT
);
CustomTile tile = new CustomTile.Builder(context)
.setIcon(R.drawable.tile_icon)
.setLabel("Test Tile")
.setOnClickIntent(clickIntent)
.build();
CMStatusBarManager
.getInstance(context)
.publishTile(1234, tile);
}
}
private boolean supportsCustomTiles() {
try {
Class.forName("cyanogenmod.app.CustomTile");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}https://stackoverflow.com/questions/22424914
复制相似问题