-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getToken() not working on Android #36
Comments
Hi Robert - I'm wondering if you have had success with this lately? I ran a Translate.execute() on Android 4.0.3 and v0.6.1 of the microsoft-translator-java-api, and was unable to reproduce the problem. Please advise, and if it is no longer a problem, I will close this issue. Thanks! |
Jonathan- Did you test using a Client Id and Client Secret, or an App ID? I'm still seeing an error with Android 4.0.3 and microsoft-translator-java-api v0.6.1. The stack trace is below. The only thing I'm doing that's unusual is running in an AsyncTask to avoid getting a NetworkOnMainThreadException. [1] While I don't think this is really a bug in this project, please consider keeping this issue open in case we can find a workaround.
[1] http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html |
I was setting only clientId and clientSecret, so I know that it was making the call to getToken() successfully. Also, I was invoking Translate.execute() from an AsyncTask. One thing I did not do was run the code on an actual Android device. I tested it on a 4.0.3 AVD image only, which may be why we're seeing different behavior. Unfortunately, I'm not sure I'll be able to get my hands on a device running 4.0.3 any time soon. I agree, we should keep this issue open until it has been solved. |
I also have met this error. Hope that can help you! |
I have a problem, using microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar api for android 4.0,i can't get |
There seems to be a problem with the POST in getToken() not returning a result when running on Android.
I tested it on Android 4.0.2. When I replaced the method with a new one using Apache Commons' HttpClient instead of HttpURLConnection, the method worked. HttpURLConnection is the recommended HTTP client on Android 2.3.x, though. [1]
Sorry for the lack of detail on this--I plan to take a closer look when I have a chance.
[1] http://android-developers.blogspot.com/2011/09/androids-http-clients.html
The text was updated successfully, but these errors were encountered: