簡體   English   中英

使用Git REPO實現Android EventSource https://github.com/streamdataio/eventsource-android/ private onConnect錯誤

[英]Implementation of Android EventSource Using Git REPO https://github.com/streamdataio/eventsource-android/ private onConnect Error

我正在通過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();

}

我是Lorie,來自streamdata.io。 感謝您查看我們的樣本項目。 確實,您是第一個報告此類問題的用戶。 您提供的代碼似乎沒有錯。 請確保您的eventSource對象已在代碼中以EventSource類型聲明為較早,並且您導入了正確的EventSource類:tylerjroach.com.eventsource_android.EventSource; 如果仍然遇到問題,建議您將代碼放在GitHub公共倉庫上,然后將鏈接發送給我們,以便我們幫助您解決問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM