【问题标题】:Will this be possible with Android wearable sdkAndroid可穿戴sdk是否可以实现这一点
【发布时间】:2014-03-21 20:34:11
【问题描述】:

我一直在阅读有关可穿戴设备 sdk 以及它现在和将来可以做什么的信息。

我的问题是,用户是否能够按下手表上的某些东西来提醒我的应用程序有智能手机上的某些东西,或者用户是否必须对着手表说话或接收来自我的应用程序的通知才能与我的智能手机应用程序交互?

谢谢

【问题讨论】:

    标签: android wear-os


    【解决方案1】:

    你将能够有“行动”,所以是的。例如,Gmail 应用程序的其中一项操作是您可以“回复”、“全部回复”等,这些操作会在您的手机上弹出。

    根据 Android Wear 开发者网站,以下代码 sn-p 将在您的手持设备上启动一个意图: // 为查看地图的操作构建意图 Intent mapIntent = new Intent(Intent.ACTION_VIEW); URI geoUri = Uri.parse("geo:0,0?q=" + Uri.encode(location)); mapIntent.setData(geoUri); PendingIntent mapPendingIntent = PendingIntent.getActivity(this, 0, mapIntent, 0);

    NotificationCompat.Builder notificationBuilder = 新的 NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_event) .setContentTitle(事件标题) .setContentText(事件位置) .setContentIntent(viewPendingIntent) .addAction(R.drawable.ic_map, getString(R.string.map), mapPendingIntent);

    请参阅:http://developer.android.com/wear/notifications/creating.html 了解更多信息。请参阅名为“添加操作按钮”的部分

    【讨论】:

    • 谢谢,但是例如,用户如何访问/打开 gmail 应用程序?
    • 查看编辑后的答案。对于我在手机上编辑时出现的格式错误,我深表歉意。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-16
    相关资源
    最近更新 更多