I need to integrate a simple Web API in my Android application, and I was looking for a way to do that.
I was told I should use a service, but other peoples told be about Robospice, AsyncTasks, and Java Threads.
What should I use ? Is there some ressources out there ?
This goes through integrating a Web API into an Android app step by step, using AsyncTask.
http://blog.strikeiron.com/bid/73189/Integrate-a-REST-API-into-Android-Application-in-less-than-15-minutes
For more improved and fast response use Android Asynchronous Http Client with Gson library : You will find a complete tutorial here
Related
I am currently going to write an Android and iOS app, which is heavily based on communication with RestAPI server.
My goal is to write communication, parsing, etc. only once. I've heard about Kotlin shared library, yet wasn't able to get it working yet.
Before wasting more time on trying to get that working, is that the way to go?
What other ways would you suggest to me?
Thank you
What you are looking for is probably Kotlin MultiPlatform Projects. Check out https://ktor.io, which allows you to write networking code only once. Also checkout https://github.com/Kotlin/kotlinx.serialization for JSON serialization.
In my android app, I'm using 3rd party libraries like fresco and okhttp3. I want to trace the response of every request made through these libraries. And i want to do it globally
I'm using react-native also in my app, and i wants to trace the response of each api call made from react-native code like firebase performance monitoring tool.
Any idea how firebase is doing this?
In okhttp3 i can add interceptor to track these, but request made through fresco and react-native I'm not able to track like this
#JM India
Please check Android Snooper library. If I understand you problem correctly this is what you are looking for.
Hope this helps you.
You can use Charles . This tool is powerful to trace all request and response. It works for all platform.
In development, you can use Stetho to trace any calls via a Network Intereceptor.
There will be different ways to get the active OkHttp instance for different frameworks e.g. ReactNative.
https://blogs.msdn.microsoft.com/jpsanders/2013/04/03/configuring-fiddler-to-be-a-proxy-for-android-emulators-in-eclipse/
here's how I used to do it. All you have to do is set up a proxy using fiddler and configure your emulator to use it
I need to know that whether we can use same database or URL for ios as well as android.
For example I am logged in with android so in the section where we use the URL , can we use the same URL for android which we use for ios. Actually I want to make an app for ios and android both.
But I want to make only one database for both that is android and ios.
I have tried using one URL in my login activity which was working on ios..but its not working.can somebody guide me?
Yes. It is very possible. It depends on the method youu are using to retrieve/send data to the database. The most popular ways to do the same is use of REST or SOAP to do client-server communication. Both work fine, but you will need to learn about doing the same. I would recomment REST for android since it is the most commonly used and is also easy to understand and use.For Ios i would recommend the AFNetworking library, speed is recommendable. You can download the library using this link:
https://github.com/AFNetworking/AFNetworking
i have used zkSforce library for IOS but now i want use for android because c panel created in saleforce so i don't have library and any solution for this. Please provide me any hint or solution.
Thanks for advance
You have 2 main options
1) Mobile SDK for Android, see https://github.com/forcedotcom/SalesforceMobileSDK-Android this provides a wrapper for the Salesforce REST API and includes pre-canned implementations of the OAuth login flows etc.
2) WSC see https://github.com/forcedotcom/wsc is primarily a java soap stack and wraps the Salesforce SOAP APIs (this is the same API that ZKSforce wraps). This should be usable on Android, but provides nothing Android specific.
I'd recommend (1) unless you have specific requirements to call the SOAP API.
I have created a Rest Web service using Jersey in a Java EE app. And I was able to create the client in a java app as well. I worked fine.
I'm now trying to consume my Web Service, but this time using Android.
I understood that Jersey libraries are not android oriented (Is that even true ? Please confirm this information ) and I read that Restlet is an alternative to build the Android Client.
How is that possible ? do you have any tutorials or documentation I can read for this purpose ?
"I understood that Jersey libraries are not android oriented (Is that even true ? Please confirm this information )"
This is pretty obvious. If you do the search on the jersey site, nothing shows up.
Also, it's pretty hard to find tutorial about Restlet on Android. I think you have to adapt from Java version. Personally, I use a plain http client to do REST stuff. (I think many people also do that.)
Regarding Restlet, you might find these useful:
http://weblogs.asp.net/uruit/archive/2011/09/13/accessing-odata-from-android-using-restlet.aspx
http://restlet.org/learn/guide/2.1/editions/android/
http://blog.restlet.com/2009/05/06/restlet-available-on-android-phones/
These questions are very helpful if you change your mind and want to do it without a framework.
Restful API service
Need sample Android REST Client project which implements Virgil Dobjanschi REST implementation pattern
I've seen people having trouble with using Jersey on Android before. You have to battle through a lot of exceptions to get it to work. There is a library on github that attempts to provide android support for jersey but I've not used it myself.
Restlet is available on android phones and you will have an easier time integrating it and getting it to work. However, I've personally found that using the HTTP client library on Android coupled with an external library to perform serialization / deserialization ( like gson ) is the easiest route to writing a REST client.