Forums » Bugs & Problems Search

on android New Reply

Author Post
Posts: 16
Registered: Jul 18, 2012

Can I use the EchoNest on Android with jEN.jar ? I tried it but it doesn't work , How do I use EchoNest on Android ?

Posts: 1098
Registered: Sep 08, 2008

Lukelu1231 - We know of folks who have used the jEN API on Android. One common problem we see for Android developers is that they fail to include the json-simple jar file (which is required for jen). Look for json_simple-1.1.jar in the lib directory of the jEN distribution and make sure it is included in your Android build. -- Paul

Posts: 16
Registered: Jul 18, 2012

I use the jEN.jar in java, and run the example "SimilarArtists" , it shows the result in the Console window. But in Android I cannot get the result by changing "System.out.println" to "TextView1.setText()" ? How can I use with json_simple-1.1.jar ?

Posts: 16
Registered: Jul 18, 2012

Do you have example code that give command to Echonest on Android ? Thank you .

Posts: 16
Registered: Jul 18, 2012

The response of "SimilarArtist Example" is not in json format , isn't it ?

Posts: 1098
Registered: Sep 08, 2008

Hi Lukelue1231 - If you are able to see similar artists results in the console window, then I think you have the API working on Android properly. To get the results displayed via android widgets with textview.setText is something you'd best ask on an Android support forum. And no, the output of the SimilarArtist example is just simple text, it is not Json. -- Paul

Posts: 16
Registered: Jul 18, 2012

Hello , thank you for the previous reply. It's ok when I use "echoNest.getMinCommandTime()", because the return of it is an int type. But it gets error when I use "echoNest.newArtistByName()" , because the return of it is a "Artist" object? But Everything in the java project can run, so I think the problem is this...

Posts: 16
Registered: Jul 18, 2012

do you know any android example that uses Echonest ?

Posts: 16
Registered: Jul 18, 2012

I think I don't have my API working on Android properly, because it still goes error if I use system.out.println(). The "echoNest.getMinCommandTime()" need not to link to Echonest, so it doesn't go error, right?

Posts: 16
Registered: Jul 18, 2012

in my Android project , as the program executes "Artist aqua = echoNest.searchArtists("Aqua").get(0);" , I find the message in my LogCat : Sending 1 51 1343028215014--> http://developer.echonest.com/api/v4/artist/search?name=Aqua&api_key=P3A9** , , and the next message show "thread exiting with uncaught exception". I browse this website and I find the informations for Aqua(a singer) in json format , I guess that means in my Android project it can successfully use the API_KEY and link to Echonest, but it fails to change the json informations to "Artist" object ...

Posts: 16
Registered: Jul 18, 2012

Add the following to onCreate() so that we can use jEN.jar on Android :

StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build())

Posts: 1
Registered: Jun 19, 2014

Thanks a lot for that. Just pasting that line into the onCreate of the app makes Echo Nest jEN.jar work like a charm. Guess this thread can be marked solved!

Reply to this Thread

You must log in to post a reply.