Android : The FileNotFoundException happened when I try to get the Datastream for Xively by Android

on Monday, August 4, 2014


I am trying to develop the Xively for Android. I have create the device and get the FeeID and ApiKey on Xively. I also download the Source code for Android on Xively.


I try to get the all DataStream by following code , I already displayed my FeeID and the ApiKey to the myFeedId and the myApiKey respectively.



Response response = null;
try
{
service.setApiKey(myApiKey);
response = service.listDatastream(myFeedId);

} catch (RemoteException e)
{
Log.e(DemoActivity.TAG, "onClick failed", e);
}

if (response != null)
{
resultField.setText(response.getContent());
}


But I get the error log like the following:



D/HttpTask( 1938): Response on request: Forbidden
W/HttpTask( 1938): Request was not made successfully
W/HttpTask( 1938): com.xively.android.service.exception.RequestUnsuccessfulExcep
tion: Unable to open connection for request.
W/HttpTask( 1938): at com.xively.android.service.HttpTask.makeRequest(HttpT
ask.java:98)
W/HttpTask( 1938): at com.xively.android.service.HttpTask.doInBackground(Ht
tpTask.java:32)
W/HttpTask( 1938): at com.xively.android.service.HttpTask.doInBackground(Ht
tpTask.java:1)
W/HttpTask( 1938): at android.os.AsyncTask$2.call(AsyncTask.java:287)
W/HttpTask( 1938): at java.util.concurrent.FutureTask.run(FutureTask.java:2
34)
W/HttpTask( 1938): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.j
ava:230)
W/HttpTask( 1938): at java.util.concurrent.ThreadPoolExecutor.runWorker(Thr
eadPoolExecutor.java:1080)
W/HttpTask( 1938): at java.util.concurrent.ThreadPoolExecutor$Worker.run(Th
readPoolExecutor.java:573)
W/HttpTask( 1938): at java.lang.Thread.run(Thread.java:841)
W/HttpTask( 1938): Caused by: java.io.FileNotFoundException: https://api.xively.
com/v2/feeds/616680277/datastreams
W/HttpTask( 1938): at libcore.net.http.HttpURLConnectionImpl.getInputStream
(HttpURLConnectionImpl.java:186)
W/HttpTask( 1938): at libcore.net.http.HttpsURLConnectionImpl.getInputStrea
m(HttpsURLConnectionImpl.java:271)
W/HttpTask( 1938): at com.xively.android.service.HttpTask.makeRequest(HttpT
ask.java:94)
W/HttpTask( 1938): ... 8 more


I think my request is wrong , but I don't know how to solve it.


Does somebody can help me to get the all DataStream ?


0 comments:

Post a Comment