2016-02-16 14 views
1

我正在使用EventSource REPO https://github.com/streamdataio/eventsource-android/ 我創建了一個onConnect();方法,但是,eventsource.connect();方法是加下劃線的紅色,並說我無法訪問它,因爲它是私人的?我在網上看,每個人都使用這個REPO,沒有任何問題在這裏發生了什麼?使用Git執行Android EventSource REPO https://github.com/streamdataio/eventsource-android/ private onConnect錯誤

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

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

+0

你好,我想知道這可能是添加REPO時的錯誤。我遵循這個過程,我克隆了REPO,assembleRelease,構建了APK,然後將它作爲模塊添加到我的android studio項目中,並將其作爲編譯依賴項添加到我的應用程序中。這是正確的程序嗎? – eli

+0

你們也有公司號碼嗎? – eli

+0

雅它看起來像它不承認我的進口org.jboss.netty.channel.ChannelFuture連接 – eli