使用Git REPO实现Android EventSource https://github.com/streamdataio/eventsource-android/ private onConnect错误

时间:2016-02-16 18:37:17

标签: android git github private eventsource

我正在https://github.com/streamdataio/eventsource-android/使用EventSource REPO 我创建了一个onConnect();但是,eventsource.connect();方法用红色下划线表示我无法访问它,因为它是私有的?我在网上看了,每个人都使用这个REPO,没有问题在这里发生了什么?

 private void connect() {
    // Create headers: Add the streamdata.io app token
    Map<String, String> headers = new HashMap<String, String>();
    headers.put("X-Sd-Token", streamdataioAppToken);

    // Create the EventSource with API URL & Streamdata.io authentication token
    try {
        eventSource = new EventSource(new URI(streamdataioProxyPrefix), new URI(myApiUrl), new SSEHandler(), headers);
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }

    // Start data receiving
    eventSource.connect();

}

1 个答案:

答案 0 :(得分:1)

我是来自streamdata.io的Lorie。感谢您查看我们的示例项目。实际上,您是第一个报告此类问题的用户。您提供的代码片段似乎没有任何问题。请确保在您的代码中使用EventSource类型声明了eventSource对象,并导入了正确的EventSource类:tylerjroach.com.eventsource_android.EventSource; 如果您仍然遇到此问题,我建议您将代码放在GitHub公共存储库上,然后将链接发送给我们,以便我们帮您解决问题。

相关问题