Jump to content
JohnLM

TidHTTP under FMX for android does not work

Recommended Posts

Windows 7 Home 64bit

Delphi XE7 Professional update 1 with FireDAC and Mobile add-on

Indy version 10.6.1.518

Android version  10, (on smartphone)

Android versions  4.4.4, and  4.4.2 (both on tablets) 

 

Issue/Problem: 

When I launch the app on Android, and click on the [Submit] button, the app shuts down when it tries to access the idhttp section here:  idHttp1.get(url_address);

It works fine under Windows FMX and VCL, just not Android.

 

Can someone please help me resolve this? Thank you. 

 

History: 

Hi. I have been successfully creating small utility apps on my android devices (Galaxy S10+ (android 10) and tablets (android 4.x.x)) for the last 8 years.

 I've been playing around with a new windows project using API through OMdbAPI (an IMDB knock-off) to get quick movie/tv series info. The API is free for 1000 requests. I love it. It works well. 

Usage is simple, using the following -> [https://www.omdbapi.com/?t=Contact&apikey={8-dig-key-code}] as it will give back a JSON string (below), then I parse it to get back a two-column detail to visualize the data better. Later I plan to fine-tune it and display only certain info from it. Right now, I am simply debugging it on Windows 7 and Android.

{"Title":"Contact","Year":"1997","Rated":"PG","Released":"11 Jul 1997","Runtime":"150 min","Genre":"Drama, Mystery, Sci-Fi","Director":"Robert Zemeckis","Writer":"James V. Hart, Michael Goldenberg, Carl Sagan","Actors":"Jodie Foster, Matthew McConaughey, Tom Skerritt","Plot":"Dr. Ellie Arroway, after years of searching, finds conclusive radio proof of extraterrestrial intelligence, sending plans for a mysterious machine.","Language":"English, Spanish, German, Russian","Country":"United States","Awards":"Nominated for 1 Oscar. 14 wins & 32 nominations total","Poster":"https://m.media-amazon.com/images/M/MV5BYWNkYmFiZjUtYmI3Ni00NzIwLTkxZjktN2ZkMjdhMzlkMDc3XkEyXkFqcGdeQXVyNDk3NzU2MTQ@._V1_SX300.jpg","Ratings":[{"Source":"Internet Movie Database","Value":"7.5/10"},{"Source":"Rotten Tomatoes","Value":"68%"},{"Source":"Metacritic","Value":"62/100"}],"Metascore":"62","imdbRating":"7.5","imdbVotes":"274,457","imdbID":"tt0118884","Type":"movie","DVD":"16 Dec 1997","BoxOffice":"$100,920,329","Production":"N/A","Website":"N/A","Response":"True"}

 

OMdb_API_v01.thumb.png.a441b78238da4140ffd4030f04e6ad74.png

 

 

 

 

 

 

Edited by JohnLM

Share this post


Link to post

Dave, (or anyone else) which section from the posted link should I be looking at? 

 

Looking through the maze of info, (it is all confusing to me. I am no Android expert. ) I have tried random ideas but still had no success.., the app continues to shut down. 

Share this post


Link to post

I think Dave is trying to tell you to read highest scored Remy's answer there.

 

I would say, it would be easier for you to use TNetHTTPClient on Android platform.

 

 

  • Like 1

Share this post


Link to post

Hi, I'm still up trying to find a solution.

 

I've recently read about the TNetHTPClient, but it is for XE8 and onward.  I have not found any package of it for XE7.

 

If I can't find a solution for Indy, then I am hoping there is a component (with a similar operation to idhttp) elsewhere.

Share this post


Link to post

Just to update you on the process..

 

I am using the USB cable to deploy apps on the android, not the Google Store. I have never used that route, nor do I know anything about it.  I use the USB route to add apps to my android device(s).

 

Right up to now, I was using my smartphone, S10+ which has Android 10 on it.  This device shuts down the app.

 

Now, I am trying my old Acer tablet with Android 4.4.4 and an even older LG tablet with Android 4.4.2 on it. When I attempt to deploy the app on either of them via the USB cable, (and press the [submit] button in the app to process the idhttp) the app on both tablets does not shut down, instead, they display the same message:

"IOHandler value is not valid"

 

I thought for sure, that the LG 4.4.2 tablet would work for the "idhttp" component on android since I purchase both Delphi XE7 Pro and it, back in December 2014.

 

So now, I am wondering if anyone ever did use the Indy TidHttp component on these much older androids successfully. 

Edited by JohnLM

Share this post


Link to post

update..

 

I decided to remove the tidhttp1 and IdSSLIOHandlerSocketOpenSSL1 components and re-add them to the project.  This time, the LG Android 4.4.2  tablet is giving me this message: 

 

"Error resolving Address www.omdbapi.com: (7)"

Share this post


Link to post
1 hour ago, JohnLM said:

So now, I am wondering if anyone ever did use the Indy TidHttp component on these much older androids successfully

Up until a few months ago, I was using them (for my client) on Android devices with version 4.4. 

11 hours ago, ertank said:

I think Dave is trying to tell you to read highest scored Remy's answer there.

Exactly.

Share this post


Link to post
19 hours ago, JohnLM said:

Indy version 10.6.1.518

Why are you using such an old version of Indy?  The latest version is 10.6.2 (the build number was lost a few years ago when Indy moved from SVN to GitHub - open issues #292 and #328).  You should upgrade to the latest from Indy's GitHub repo (and yes, it supports XE7).

4 hours ago, JohnLM said:

When I attempt to deploy the app on either of them via the USB cable, (and press the [submit] button in the app to process the idhttp) the app on both tablets does not shut down, instead, they display the same message:

"IOHandler value is not valid"

That error means that an HTTPS url is being requested but an SSLIOHandler component is not assigned to the TIdHTTP.IOHandler property.

Edited by Remy Lebeau

Share this post


Link to post

update..

 

I have the issue partially solved, in the two tablets only. 

 

But, to answer Remy's question.  I don't have the latest version because I had never used them in mobile devices.. only in Windows. And I never had any issues. They just worked.

In Android mobile devices is where and when I just found out they don't work.  Well, at least not for Android 10 on my smartphone. So, I wouldn't know if they are outdated and/or need to be upgraded.

 

But, as it turns out, for the Android 4.4.2 and 4.4.4 on my two tablets, I did not have the Internet turned on, for those two devices. You see, in order to save battery life, I had turned off the auto-internet feature of those devices, and when I started using them in this project and with the Indy tidhttp component for the first, that is when I discovered all this trouble. 

 

However, the app no longer gives me any trouble for android 4.4.2 and 4.4.4 on the tablets.., it is working fine. 

 

I just need to get it working on the smartphone.

Share this post


Link to post
11 minutes ago, JohnLM said:

I just need to get it working on the smartphone.

Smartphone is a general term that could refer to Android or iOS devices (being the most common types of smartphone). If you require help for the device you're referring to, please be specific.

Share this post


Link to post

Yes, I had not mentioned that earlier today I updated my original post (at the top). 

Share this post


Link to post
21 hours ago, JohnLM said:

But, to answer Remy's question.  I don't have the latest version because I had never used them in mobile devices.. only in Windows. And I never had any issues. They just worked.

In Android mobile devices is where and when I just found out they don't work.  Well, at least not for Android 10 on my smartphone. So, I wouldn't know if they are outdated and/or need to be upgraded.

Even on Windows, it is a good idea to stay up-to-date.

  • Like 1

Share this post


Link to post

Remey, I am not a GitHub user and don't understand that hierarchy system and the discussions are difficult to follow in order to get to the step(s) for the solution or links or downloads. 

 

I'm on my way to work.  Later, I will try and search this forum to see if there is a download link and installation instructions.  If I don't find any, I may have to start another topic on this Indy Upgrade process. 

Share this post


Link to post
10 hours ago, JohnLM said:

... I am not a GitHub user ....

You don't need to be a registered user, just download the ZIP file under "Code" button

image.thumb.png.5432c6180ea16bea602c5ea95734a0d6.png

Share this post


Link to post

My XE7 Pro is installed on an USB-3 external F: drive and not the usual C: drive. 

 

Will that be an issue with installation? 

Do I need to change certain files to reflect this?

Share this post


Link to post

@Rollo62, I didn't realize you were linking to an Indy-alternative. Anway, thank you. I have no issues on the Windows side of things when using Indy, so far.  But my needs are for Android 10 and onward.  And I would need an http.get() equivalent to Indy's.  Once again, thanks for your suggestion. 

Share this post


Link to post
23 hours ago, JohnLM said:

My XE7 Pro is installed on an USB-3 external F: drive and not the usual C: drive. 

 

Will that be an issue with installation? 

Do I need to change certain files to reflect this?

I don't know.  Worse case, you could simply not install Indy into the IDE at all, and just have your project refer to Indy's source files directly.

Share this post


Link to post

To be safe and mostly headache-free, I am making a backup copy of the F: drive mem stick, and after that, I will re-image my laptop's C: drive using Reflect Macrium. This way I can restore both mediums if all else fails. 

Share this post


Link to post

Update..

 

Great news.. after so many weeks and hours of searching and reading (and breaks, here and there), I have finally succeeded!! No more issues with SSL errors. 

 

I am now able to deploy apps using Indy v10.6.1.518 to my Galaxy S10+ smartphone (Android 10) using Delphi XE7 Professional under Windows 7 Home Prem 6 GB ram 64-bit laptop.  I suffered many headaches over this. 

 

The screenshot below shows proof that I accomplished it.  It is the same VCL app that I posted a screen copy of in my original post above, but this time in a redesigned FMX framework and deployed to the android 10 smartphone.   

 

I actually owe the thanks to Remy, from reading one of his posts over in StackOverFlow from 2016 through 2021.  Actually, all the answers were spread out across many forums and topics.  I just had to piece them all together somehow. 

 

This link, over at StatkOverFlow, https://stackoverflow.com/questions/37105600/error-could-not-load-ssl-library-on-android-with-tidhttp helped me to figure out the last piece of the missing part of many parts to get all this working.  An excerpt from Remy's response near the bottom of that topic:  

 

Quote

 

@BDuarte IdOpenSSLSetLibPath() is in the IdSSLOpenSSLHeaders unit. Make sure that unit is in your uses clause – Remy Lebeau | Feb 15 at 21:45

 

 

So, thank you Remy  :classic_smile:

 

OMdb_fmx_xe7_v01.thumb.png.dca7a7acbd49db3c4bec0ede2c1aeb60.png

Share this post


Link to post
10 hours ago, JohnLM said:

I am now able to deploy apps using Indy v10.6.1.518

That is a VERY old version of Indy.  Indy has been in 10.6.2.x since 2015.  You should seriously consider upgrading to the latest version from Indy's GitHub repo.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×