我在Smart Watch 2上使用Control API 2.0,松散地基于Sony SDK的SampleAdvancedControlExtension演示。在图库视图中,用户可以详细查看项目。在此视图中,我想激活智能手机上的三点操作菜单按钮。我该怎么做?当我按下三点按钮时,我的扩展应用程序会收到此事件:com.sonyericsson.extras.aef.control.KEY_EVENT
如何启动操作菜单?
我已经看到了通知API示例,并且似乎在ConfigurationInformation中配置了操作菜单:
@Override
public ContentValues getExtensionRegistrationConfiguration()
{
Log.d(NuExtensionService.LOG_TAG, "getExtensionRegistrationConfiguration");
String iconHostapp = ExtensionUtils.getUriString(mContext, R.drawable.icon);
String iconExtension = ExtensionUtils.getUriString(mContext, R.drawable.icon_extension);
String iconExtension48 = ExtensionUtils.getUriString(mContext, R.drawable.icon_extension48);
ContentValues values = new ContentValues();
values.put(Registration.ExtensionColumns.CONFIGURATION_ACTIVITY, NuPreferenceActivity.class.getName());
values.put(Registration.ExtensionColumns.CONFIGURATION_TEXT, mContext.getString(R.string.configuration_text));
values.put(Registration.ExtensionColumns.NAME, mContext.getString(R.string.extension_name));
values.put(Registration.ExtensionColumns.EXTENSION_KEY, NuExtensionService.EXTENSION_KEY);
values.put(Registration.ExtensionColumns.HOST_APP_ICON_URI, iconHostapp);
values.put(Registration.ExtensionColumns.EXTENSION_ICON_URI, iconExtension);
values.put(Registration.ExtensionColumns.EXTENSION_48PX_ICON_URI, iconExtension48);
values.put(Registration.ExtensionColumns.NOTIFICATION_API_VERSION, getRequiredNotificationApiVersion());
values.put(Registration.ExtensionColumns.PACKAGE_NAME, mContext.getPackageName());
values.put(Notification.SourceColumns.ACTION_1, mContext.getString(R.string.action_event_1));
values.put(Notification.SourceColumns.ACTION_2, mContext.getString(R.string.action_event_2));
values.put(Notification.SourceColumns.ACTION_3, mContext.getString(R.string.action_event_3));
values.put(Notification.SourceColumns.ACTION_ICON_1, ExtensionUtils.getUriString(mContext, R.drawable.actions_1));
values.put(Notification.SourceColumns.ACTION_ICON_2, ExtensionUtils.getUriString(mContext, R.drawable.actions_2));
values.put(Notification.SourceColumns.ACTION_ICON_3, ExtensionUtils.getUriString(mContext, R.drawable.actions_3));
return values;
}
这是否意味着操作菜单仅适用于基于通知的应用程序?
谢谢,
的Andrej
答案 0 :(得分:2)
Ahhhh发现它......对于其他人:可以在onKey()方法中将意图Control.Intents.CONTROL_MENU_SHOW发送给主机。意图采用动作菜单项(图标或文本)列表。