From this time, I will talk about server-client communication. Eventually I want to get a value (eg an integer) from the server.
First ** Thank you to all the posters of the reference site **.
It was the first day of the survey, but I found it quite difficult. I haven't succeeded, so I'll write down where I'm stumbling.
Socket I don't know anything, so I'll search for it. ----- * Reference URL: https://zawapro.com/?p=687 ----- * Search word: "android server client communication"
With this search word, there were many sites that dealt with Socket. However, the above site has a console-based server and It was data transmission, not data acquisition. It's a very helpful site, but it's different from the purpose, so I changed to another method.
Next, we decided that ** connecting to the target site is the key **, and The following program was implemented in the button click event.
Uri uri = Uri.parse("https://jp.heroku.com/");
Intent intent = new Intent(Intent.ACTION_VIEW, uri );
startActivity(intent);
When I ran it, the button appeared, but I can't fly to the target site by clicking. ----- * Reference URL: https://android.roof-balcony.com/intent/browser/ ----- * Search word: "Connect to android URL"
There is no problem in implementation, so ** I thought that the wifi access point of the emulator was strange **, I changed the access point from the terminal settings as follows.
・ Proxy 10.0.2.2 ・ Port 8080
----- * Reference URL: http://www.hnyssh.net/?p=793 ----- * Search word: "android emulator wifi connection"
But this didn't work either. Since the wifi access mark of the emulator was also ON, It seems unlikely that wifi is not connected. Let's try another method ...
JSON Apparently there is an API that handles a data format called JSON, so I will switch to the method that uses JSON.
----- * Reference URL: https://qiita.com/hkusu/items/8572d768243fe7e7ed88 ----- * Search word: "android JSON external API"
There were many sites that seemed to fit this purpose with this search word.
I plan to write an article about JSON. that's all.
Recommended Posts