首页 文章

更新后的内置操作和自定义操作的Google Glass时间轴通知不起作用(XE-16玻璃更新)

提问于
浏览
1

我们开发了谷歌玻璃器皿(基于时间轴)的应用程序 . 首先,我们将向玻璃板发送一些时间线卡片,其中包含一些内置菜单项和自定义菜单项 .

我们已配置代理网址以获取时间线的通知 .

它工作了很多天 .

But After Google Glass XE-16 update we are not getting the timeline notifications

能否指导我们解决问题 .

嗨囚犯,

for inserting timeline we have used the following code:

global $base_url="http:\/\/mysite.com\/mirror"; 

$client = get_google_api_client(); 

$client->setAccessToken(get_credentials($_SESSION['userid'])); // A glass service for interacting with the Mirror API 

$mirror_service = new Google_MirrorService($client); 

    $new_timeline_item = new Google_TimelineItem();
    $new_timeline_item->setText('Hey I am testing new');

    $notification = new Google_NotificationConfig();
    $notification->setLevel("DEFAULT");
    $new_timeline_item->setNotification($notification);

    $menu_items = array();
    $custom_menu_item = new Google_MenuItem();
    $custom_menu_value = new Google_MenuValue();
    $custom_menu_value->setDisplayName("Add Item");
    $custom_menu_value->setIconUrl( $base_url . "/static/images/tulip.jpg");
    $custom_menu_item->setValues(array($custom_menu_value));
    $custom_menu_item->setAction("CUSTOM");
    $custom_menu_item->setId("add_to_cart_item"); // This is how you identify it on the notification ping
    array_push($menu_items, $custom_menu_item);
    $new_timeline_item->setMenuItems($menu_items);


    insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($base_url . "/static/images/tulip.jpg"));

为此,我们尝试添加新的自定义菜单和内置菜单,如(pin,delete,share,send)

To subscribe to notifications we have used the Google glass Php mirror api function.

subscribe_to_notifications($mirror_service, "timeline", $_SESSION['userid'], $base_url . "/notify.php");

在XE-16版本更新之前,所有这些都正常工作 . 更新后,我们无法获得时间线卡通知的通知

1 回答

  • 0

    这是发送图像附件的已知问题 . 详情请见:
    https://code.google.com/p/google-glass-api/issues/detail?id=491

    因此,必须更改的代码部分是:

    insert_timeline_item($mirror_service, $new_timeline_item, "image/jpeg", file_get_contents($base_url . "/static/images/tulip.jpg"));
    

    需要改为:

    insert_timeline_item($mirror_service, $new_timeline_item, null, null);
    

    并使用setHTML而不是setText,并包含一个带有src标记的img元素,该标记指向Web URL . 例如 . :

    <img src="http://example.com/static/images/tulip.jpg" />
    

    请注意,您还必须在出厂时重置Glass . 您可以通过尝试运行菜单命令来判断是否存在问题,并且右下角的旋转双箭头卡住,并且在Glass上的ADB logcat输出上可以看到崩溃堆栈跟踪 . 因此,要解决此问题,首先必须不使用图像附件,然后必须重置Glass以修复Glass上损坏的时间轴同步 .

相关问题