Using Kotlin as RestAPI parser for Android and iOS - android

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.

Related

can I use the same database for android which I used for ios?

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

How to integrate a simple API in an Android application

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

Web and Mobile backend framework and protocol

I am looking forward to build a mobile application, android for now but will be extendable to iOS and also a Web app. I am planning to build a common backend and use REST and expose the API's which will be consumed from different applications.
I am looking for suggestions for a technology stack best suitable for this kind of architecture?
I would strongly suggest Nancy. The main advantage being that it is super easy to set up and it does all the things you would normally expect from a REST service. JSON serialization, routes, parameters etc...
And you can code it in C# .NET, without having to write the boilerplate code that is usually necessary to get this sort of simple functionality running.

Generated Soap Classes for Android

Currently I am working on an iPhone app. But the company also would like to have an android version for this app.
I have programmed all the request by Soap and used for the iPhone the Soap Request Generator of Sudz-C.
I am wondering now if something similar exists for the Android, It would be nice if I don't have to program this all by myself.
Anyone have some experiences or ideas?
You can use
http://easywsdl.com
website to generate all required java classes for your webservice. It uses ksoap2 library and supports many features like objects sent as references (WCF IsReference), complex inheritance, document and rpc style of webservice, all standard data types (including normal enums and IsFlag enums), and much more
ksoap2-android is what you are looking for, it will send/recive soap request's, is easy to use and on MIT license
I go through a lot of solution solution in WSDL 2 android. google don't matter about SOAP service and provide anything for it. wsdl2java won't work in most of case, some library cannot be use by android SDK. I suggest you to use http://easywsdl.com.
you'll see you can edit your own package name, class prefix and many other parameters depends on your need. If you have complex data and your are familiar to use Gson (https://code.google.com/p/google-gson/) to send parameter between your activities don't check "Use JodaDate" that is a great library for using date, but Gson doesn't support it (yet).
If you have few services that don't work (yes that can happen, depend of your WSDL configuration file), report it to contact and they will make the possible to fix your issue like they did for me.
The generator is fast. you will receive all your generated code and the .jar that you'll have to import into your project.

what approach to use for webservices and android?

I need an advice if you may. I want to use webservices in Android and so far i am very much confuzed of the path i shoudl follow. I understand that there are 2 ways...soap and rest.
Trying to use soap(no native implementations) with a third party jar, ksoap.. that was fun but does not work. After finding a jar that actually compiles, and trying with some code i found on google i found that some methods do not exist in that jar and did not work.
Now I am trying to use Rest, found this project here and trying to get what they did here.
I worked once with webservices and using a wsdl url, and axis2 i managed to generate stub classes.
I am really confuzed now :) what is the best approach, what to use in android?
Thank you.
I would suggest using REST as it is light weight as compared to SOAP. Also people have reported lot of performance issues with libraries like kSoap.
If you still want to use SOAP create soap message on your own programmatically instead of using a library.
For JSON processing try using GSON library http://code.google.com/p/google-gson/

Categories

Resources