0

我想在我的应用程序中集成 Glympse API,其中我的移动应用程序有两个用户,分别使用应用程序,如果一个人想查看另一个人的实时位置,并且他们都在不同的模块上工作,但相同的应用程序.

您的 Glympse API 是否可行?

此外,在尝试使用以下代码发送 Glympse 票证时,我在从 GlympseLiteWrapper 获取实例时得到空指针

**/*Send a Glympse*/**
        GTicketLite ticket = LiteFactory.createTicket(3600000, "Going home!", null);
        // Set flags that adjust the presentation of the Glympse Send Wizard. 
        // These can enable/disable fields in the wizard screen.
        final int WIZARD_FLAGS 
         = LC.SEND_WIZARD_INVITES_EDITABLE
         | LC.SEND_WIZARD_MESSAGE_EDITABLE
         | LC.SEND_WIZARD_DESTINATION_EDITABLE
         | LC.SEND_WIZARD_TIME_EDITABLE;
        // Launches the wizard which will send the Glympse
        GGlympseLite glympse = GlympseLiteWrapper.instance().getGlympse();
        glympse.sendTicket(ticket, WIZARD_FLAGS);
4

1 回答 1

0

空指针异常很可能是因为 Glympse 平台在调用这些方法之前没有启动。请参阅我们的 Lite SDK 中的示例应用程序,了解如何在 Android 的 Activity 生命周期方法中处理启动和停止平台的示例。在您的应用程序中启动平台应该如下所示

@Override protected void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Start up the Glympse API
    GlympseLiteWrapper.instance().start(this);

    // Register this class as a listener for Glympse events
    GlympseLiteWrapper.instance().getGlympse().addListener(this);
}

还要确保您已从我们的开发人员站点获得 API 密钥并将其设置在 GlympseLiteWrapper.java 中。

您的用例听起来绝对可以很好地利用 Glympse API。Lite SDK 仅支持在 Web 浏览器中查看 Glympses。商业 SDK 带有用于在您自己的应用程序中显示收到的 Glympses 的工具。

请参阅此处了解 Lite 和商业 SDK 之间的差异列表,如果听起来您需要我们的完整 SDK,请向我们发送消息:https ://developer.glympse.com/comparison

于 2014-02-19T20:52:33.567 回答