How to recive and parse a HTTP Json-File in Kotlin - android

I´m programming an Android App that recives Data from an other device (not jet final what device some kind of Wifi board) via HTTP Json-File but i dont know how to "pull" the file and parse it. I´m new to Kotlin so thanks for your help :)

It sounds like your not just new to android. You will need a webhost server set up. The easiest way would set it up so that when the url is connect to it echos your json response. When your app executes its http get request you parse the resonse.
I highly recommend Fuel for kotlin. It just works.
Kittinunf/fuel

Related

Build a restapi in android from JSON

Suppose I have this json file
[{"item_id":"1000","item_name":"PEn","item_quantity":"2.66","item_rate":"3.69","item_purchase_date":"2020-05-13T00:00:00Z"},
{"item_id":"1004","item_name":"box","item_quantity":"63","item_rate":"20.5","item_purchase_date":"2020-06-12T00:00:00Z"}]
I want to make a rest api using this json file in Android. This json file should be locally available in my android device. When I send a certain request (GET/DELETE/etc.) to a certain URL (localhost:3000/posts), I want to perform requested operation.
Please show me how can I achieve this.
UPDATE 1: I don't need NanoHTTPD. (Its better if I can find something like golang with postgres)
To serve an api on an android device, you would need a webserver. The easiest way would be to extend a Java HTTP server and add your own logic.
Try NanoHTTPD, you can easily use it in android.

how to use Apache at my Android App

I want to read and update data from server (using Apache) to my Android App.
I`m new at the Apache part.can anyone give me a guide for this kind of operation? I already download "XAMPP", and my main goal is to read a JSON into my App, but I believe I can manage also with php .
I know that this is general question but I don't understand at this subject.
Thanks.
the most basic way is to make sure your web server is listening on an open port(usually 80). in your android app send a request to your webserver (url request). on your server hava a script that echos or prints JSON data...
Apache is a web server. You need to connect to it using HTTP. There is an HttpClient and other ways to get http server data, as long as you have a network connection.

Set up a server and get feed from it in android

This may not be the type of question I am supposed to ask here but I don't have anywhere else to go. I want to make an android application which gets feed from a web-server and displays in the application. It will be kind of a newspaper app. I have done my share of work: I know android application developemnt: have made some apps. Also, I have an idea of UI: a listview with the feeds and then on selecting an element I will open another activity with the complete feed. What I wanted to know is:
How to set-up a server for this?
How to request?
Can I set-up a free server?
I dont want to use GCM as I don't think it allows sending pictures. Plus it allows small data to be sent. Also, I have no knowledge about the 3rd party server I may need to create for this.
I would want to post both text and photos (combined makes a post, total of around 10 posts) from the server. Please dont close as not a question. Any link, tutorial will be highly appreciated. For server side coding, I know php, .net. I have never coded in java for a server, but I can learn it.
Please follow following steps to get your project done.
Set up any php or Java or .Net Server (If you are aware of any of these web technologies)
After you set up server you need to make web service which will work as mediator to transfer data between your server and mobile.
Webservice response will be either in JSON or XML
Generate response according to your need and parse them on android side.
Display in listview :) :)
You can use JBOSS for your server, and do a Java Server with Webservices.
In your webservices you'll have a service that get all the feeds, and maybe another that request the complete feed...
Your "language" between the Android app and the Server, you can use XML with SOAP (ksoap2 for Android), or you can try JSON (I never used, but I will 'cause we goona need use in my service).
You can try find another free server side, but I think the SOAP is important in most of the servers to "talk" with your app.
I hope helped you.
[]s
Bertan

Pass parameters Using HTTP request

Hi i am new to android programming and i would like to know how to call a web service and pass parameters to the web service to obtain the return result in form of an XML.
I previously used Ksoap lib and SOAP request but thats not working correct so now i am trying the HTTP method.
Please Help
You will want to read up on the Apache HttpClient.
Beyond that its a matter of making sure the device and server are generating messages that the other side can correctly parse.
Is the server an existing service? Or are you designing that as well?
check the following in which you will use HTTP post request & you will get response in the form on XML
Android HttpPost: how to get the result

Get List View of data received from web service in Android

I am new to Android . I have created a web service in Visual Studio 2008. This is my web service code [http://pastebin.com/QHqL6bNx] . I have also written an Android code to call the web service from my emulator..Here is the Android code [http://pastebin.com/rDhkRTsQ] . My problem is that I want to display the data that I get from my web service in a ListView with a checkbox at the side of it . How to do that ?
Can anyone help me develop the code for it ? What changes should I do in my present code?
Thanks
You need to parse the response of the server. I recommend to encode the output of your web service to be in JSON or XML format, because its quick and easy to parse that kind of response.

Categories

Resources