How to send a HTTP request in Delphi XE5 for Android without using idHTTP
(Indy)?
Quick search revealed that there is no URLConnection
or usable AndroidHttpClient
class in Delphi's JNI.
Asked
Active
Viewed 1,363 times
0

RRUZ
- 134,889
- 20
- 356
- 483

naXa stands with Ukraine
- 35,493
- 19
- 190
- 259
-
1Sorry, I don't want to start a flame war, but why woudl you use delphi XE5? Why not android studio? Are you using the SDK? Because there is a lot of http stuff in the SDK: http://developer.android.com/reference/android/net/http/AndroidHttpClient.html – cbrulak Feb 27 '14 at 21:44
-
@cbrulak, it does not concern my preferences. I love studio, and I watch in awe as it evolves. But at this moment I am working in Delphi, and despite its drawbacks I'll keep working in it because I hope to make it a bit better for mobile development. – naXa stands with Ukraine Feb 27 '14 at 22:24
-
1If Delphi does not already provide a JNI wrapper for [`AndroidHttpClient`](http://developer.android.com/reference/android/net/http/AndroidHttpClient.html), you can easily write your own. Android classes are fairly easy to access via Delphi's JNI framework, and there are third-party import tools starting to pop up to generate Delphi JNI wrappers for Android classes. – Remy Lebeau Feb 27 '14 at 22:49
-
@RemyLebeau you should put that is an answer. – cbrulak Feb 28 '14 at 15:37
-
See also: http://stackoverflow.com/questions/9551058/ - "According to the android team you should be using HttpURLConnection on Gingerbread and better" (instead of HttpClient) – mjn Mar 02 '14 at 07:57
1 Answers
2
If Delphi does not already provide a JNI wrapper for AndroidHttpClient, you can easily write your own. Android classes are fairly easy to access via Delphi's JNI framework, there are blogs showing how to do that, and there are third-party import tools starting to pop up that generate Delphi JNI wrappers for Android classes.

Remy Lebeau
- 555,201
- 31
- 458
- 770
-
It is answer to the more general question than the one that is presented above: 'how to use an Android class that is not present in Delphi XE5?' Nevertheless I'll accept your answer, because it was very usefull. – naXa stands with Ukraine Mar 04 '14 at 06:35
-
For example: [Android2DelphiImport](http://journeyman.ath.cx/Android2DelphiImport.aspx) – Remy Lebeau Mar 04 '14 at 22:55