I'm using a Google API (in this case, Classroom) for an Android app using com.google.api.services.classroom.Classroom. I want to cache the results on the device for speed/offline usage. Is there a quick-and-easy way to do this that uses the same java API? Can put something like an HttpResponseCache in the middle there somewhere?
Depends on your definition of "quick-and-easy", but I think the accurate answer here is no (!)--those methods are designed to be used "online."
Related
TextClassificationManager is available from API-26. Its public methods available for classify text .
My requirement is i need to detect language from a giver Text offline.
TextClassificationManager also have detectLanguages() method but its hidden.
Can i Use TextClassificationManager to detect language ?
I have searched a bit and i Found This Project Using TextClassificationManager by Reflection. But it throws NoSuchMethodErrror and Returns ..
So if anyone Used TextClassificationManager for this purpose can help me .
It's a bad decision to use hidden functions via reflection. You can never know if the function will be there and available so you have to prepare a fallback mechanism.
For Android SDK 26-27 You can try and use this Android lib project - https://github.com/rmtheis/language-detection but be aware that it's no longer maintained so use it for your own research but it's probably not a good idea to use it for production or apps released in Google Play.
For my new assignment, I wanted to use some library that can provide a "Posterize effect". I found many library like Aviary SDK and jhlabs, Yes, these are easy to use, but these making the code heavier. SO I keep searching for Android's API itself which can do the similar task. And after a lot of RnD, I finally found one my time saver class EffectsFactory which provides the same as I wanted. I applied it in my assignment also. But the bad thing it was added in API level 14, And my app should be compatible with at least API level 8.
So, My question is,
Can I use EffectsFactory class for lower version? If Yes then How?
Or, If No, Then Do we have any API in Android SDK itself which do similar to effectfactory ?
Please avoid referencing any library or NDK's open cv library.
No, there is not an Android API that will posterize an image below API 14. Even above API 14 EffectsFactory may not work, as it says in the Android documentation:
Some effects may not be available on all platforms, so before creating a certain effect, the application should confirm that the effect is supported on this platform by calling isEffectSupported(String).
However, you could easily make a lightweight solution yourself. Posterization is a simple process. For example, the code behind JHlabs' posterize filter is less than 50 lines (and most of them are sugar). In your shoes, if using a 3rd party library was out of the question, I wouldn't hesitate to write my own.
Edit: If you happen to be posterizing images your app takes from the camera, there is also Camera.Parameters.setColorEffect(), but again this is not supported on all devices, as it says in the documentation:
For example, the application should call getSupportedColorEffects() before calling setColorEffect(String).
I am making application which is using a deprecated API. I have to submit it on Apple and Android App Store next month.
In this case, is there any chances to reject the application from app Store of Iphone And Android.
Don't use a deprecated API. Almost nobody deprecates something without providing an alternate means to accomplish the same task. Use the documentation to discover these alternatives, and adjust your code accordingly. What happens if iOS 5 comes out tomorrow, for instance, and all of a sudden your code breaks on those devices. You'll be scrambling to fix it. Fix it now while you have some time.
Android should not be a problem due to the fact that they won't look at your code. Apple will probably check your code and if they see it, they will most likely tell you that you are using deprecated API, but I don't think they will reject it if it is working flawlessly with it.
I used to do all XML with XStream, but now due to deprecation I'm forced to switch to JSON for two APIs, one of which is a Google API. Since there's this google-api-java-client that should work well on Android and allows to do this in a record number of very few lines of code, I'm probably going to use this.
Yaniv's Google I/O 2011 presentation is still ringing in my ear:
This library is basically designed for any API on the Web. ... Why would you want to use a different library with one vendor, and a different library for another vendor? Ideally, you'd like a library that would work with pretty much any API and have a consistent experience.
True. So here's my question: How can I reuse parts of this library for similar but non-Google APIs and make my life easier? Does anyone have any experience with this, or code samples?
The other API uses JSON. I'm talking about very simple REST calls that anonymously get data (i.e. no API keys or OAuth). No advanced stuff. I'd be happy to build my own model classes and of course realize they'd not be available. I'm probably an intermediate level developer when it comes to REST. I'll be using two different transport methods, and two different JSON parsers, based on Android SDK level.
Edit: Yup, implementing the client for the Google API was a breeze, except for wrestling with the new quota limits.
It's hard to say which components you can reuse and how you can reuse without having seen the API :)
I'd probably start by pointing the client directly at the new API and inspecting what breaks. If after digging around with the debugger the problems do not look too bad, I'd tweak the client as necessary.
However, if you're really just reading from a simple rest API, you may not find a whole lot of benefit from attempting to reuse the Google client. An HTTP client combined with a JSON parser like Jackson may be sufficient and less complex.
~~Jenny
What's the best way to use Amazon Simple Storage Service (S3) on Android?
For iPhone I use ASIHTTPRequest. Is there something similar for Android?
There is now an Amazon-supported Android SDK: http://aws.amazon.com/sdkforandroid/ . It's only been out since the end of 2010, but it seems to work well - it allowed me to easily upload a photo to S3.
To be honest I think if no library exists which works with android you will need to just roll your own. Take a look at the REST API and implement just the methods that you need for your application.
Doing it this way is more work but you will keep the filesize of your application down.
I think any S3 Java API should do it ? Look at the docs for Java API Libraries.