Start a new topic

Trouble using Target API in Android

Trouble using Target API in Android


Hi all,

I have a trouble with the Target API.

I have created an Android application which implements the sample Java code from Git Hub, using an Async Task to get the .wtc. I?m trying to  get the .wtc file for the image URLs that you have inserted into the String array called ?IMAGE_URLS?. In your sample code you have:

String IMAGE_URLS = {

"http://s3-eu-west-1.amazonaws.com/web-api-hosting/examples_data/surfer.jpeg",

"http://s3-eu-west-1.amazonaws.com/web-api-hosting/examples_data/biker.jpeg" };

But when I try to run my application, it doesn't work.

The application show the following error:

W/System.err? java.io.FileNotFoundException: http://api.wikitude.com/s/wtc-url/

W/System.err? at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:186)

W/System.err? at com.david.pruebaapi.sAPI.sendRequest(sAPI.java:165)

W/System.err? at com.david.pruebaapi.sAPI.convert(sAPI.java:232)

W/System.err? at com.david.pruebaapi.GetWTCfromURL.doInBackground(GetWTCfromURL.java:47)

W/System.err? at com.david.pruebaapi.GetWTCfromURL.doInBackground(GetWTCfromURL.java:22)

W/System.err? at android.os.AsyncTask$2.call(AsyncTask.java:287)

W/System.err? at java.util.concurrent.FutureTask.run(FutureTask.java:234)

W/System.err? at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)

W/System.err? at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)

W/System.err? at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)

W/System.err? at java.lang.Thread.run(Thread.java:856)

(GetWTCfromURL is the class which execute the Async Task )

 

But It works if I put only one URL like:

String IMAGE_URLS = {

"http://s3-eu-west-1.amazonaws.com/web-api-hosting/examples_data/biker.jpeg" };

 

I don?t understand why it happens. 

This is the last thing I need to finalize my project.

Can you help me with this? 

Do you have an Android application where Target API works with multiple URLs and runs without errors?

 

Thank you for your time.

 

Greetings,

David.

Hi David,

Thanks to trying out our Targets API.

I guess you own a Targets API TRIAL account: it has the limitation of 1 target per call.

Another tip: the URL of the Targets API endpoint is https://api.wikitude.com/targets/wtc-url 

I hope it helped!

Have a nice day,

Simone
Login or Signup to post a comment