Android Question JRDC2 okhttputil issue

Metalo

Member
Licensed User
Longtime User
I'm trying to use JRDC2 with okhttputil because httputil2 is deprecated but when I add that library to my code, I get in the log window a red Unknown member: stopautomaticforeground

So a little background. The app is a modified version of a service that answers or intercepts an inbound call. It checks a list to see if the number is blocked or not. I wanted to take it a step more by allowing you to add a number to a backend MySQL database. I had it all working with JRDC, older version and it would add to the SQL database no problem but wanted to make sure I was using new stuff, so instead of JRDC, im using JRDC2 and okhttputil. Everything checks out, the DB server gives me a good connection test via browser. When I take the httputil out and add in okhttputil it will not compile and the red log error is there.

 

Attachments

  • error.jpg
    419.1 KB · Views: 167

Metalo

Member
Licensed User
Longtime User
You should definitely use OkHttpUtils2.

You are using B4A v9.50, right?

Download the latest version of OkHttpUtils2: https://www.b4x.com/android/forum/threads/updates-to-internal-libraries.59340/#post-690638

Yes, I'm using B4A 9.50, I was previously using the Beta but just updated that, and I was previously using the 2.80 of OkHttpUtils2 which I updated as well. I went to add re-add the library to my project and it's still saying in the log Unknown member: stopautomaticforeground

Some additional things to note.

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="26" />

is in my manifest.

It's really weird, if I revert to Httputils2, then all is good, it compiles and installs but yeah I don't want to use a depreciated library.
 
Upvote 0

Metalo

Member
Licensed User
Longtime User
Start a new project and add OkHttpUtils2. Do you get this error?
Systematically, I started a new project like you said. I added all of the library resources first, then I copied over my Main activity into Main, I deleted the Starter and created a new Service module called "Service". Everything was looking good until I added the DBRequestManager, module then I got the log error Unknown member: stopautomaticforeground in red.

The DBRequestManager is from the JRDC2 area.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Please upload a bare minimum of your project that can reproduce the issue you are experiencing
 
Upvote 0

Metalo

Member
Licensed User
Longtime User
Please upload a bare minimum of your project that can reproduce the issue you are experiencing
Sure thing, attached is my simple code, it creates a service and just looks at phone state. It doesn't even begin yet to do anything with JRDC2 so I don't think it has anything to do with JRDC2, it has something more to do with OkHttputils2 added in maybe as a service? Once I remove it and use the Httputils2 library it will compile and load.
 

Attachments

  • Test.zip
    10.6 KB · Views: 181
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Everything was looking good until I added the DBRequestManager, module then I got the log error Unknown member: stopautomaticforeground in red.
When do you get this? When compiling? Here on my end, everything compiles fine (I had to comment out anything to do with AutoCall). Where are you installing your additional libraries? In the "Additional Libraries" folder or directly into the folder located under Program Files?

My setup:
Win 10 Pro (1909)
SDK Platform-Tools 27.0.1
B4A 9.5

I never touch the libraries folder in Program Files. All additional libraries are in the "Additional Libraries" folder configured in the IDE.

Note #1: Since you are using jRDC2, no #AdditionalJar: mysql-conectore-java-5.1.48-bin.jar should be required on the client side.
Note #2: Be careful with Wait For in Activity_Create. Activity_Resume will be called (most cases) before the Wait For finishes in Activity_Create. May create unexpected results.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Ok, was able to get your error message. Real simple solution: Don't name any Service/Activity/Code Module Service. Service is an Object of the Core library. If you name a Service module Service, you are "overriding" the Service object. If that makes sense. Just try it. Recreate your project and do not name your Service module Service.
 
Upvote 0

Metalo

Member
Licensed User
Longtime User
Yes sir, that fixed it! Thank you very much!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…