Android Question [SOLVED]Please a hand 🙏

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Hello everyone, I hope you are well.
I need help from someone experienced in developing B4A libraries
This library consists of communicating with a device (Dataphone) via Bluetooth for card payments.
Here I attach what I have developed but it is throwing me an error when compiling the library in SLC.
I share all the necessary information for this Library with the .aar file "mposintegrado.aar" Thanks in advance


1649199956396.png


Documentation of the assembly of the library:
 

Attachments

  • PCLServiceJH2.zip
    7.9 KB · Views: 92
Last edited:

drgottjr

Expert
Licensed User
Longtime User
a number of problems.

the SLC compiler doesn't like the character set you use for your comments in spanish.

where is com.ingenico.pclutilities.SslObject ? i didn't see it. it's not in the .aar

the error you report in your post involves a handler or callback that is just sitting out there by itself. it needs to be inside some other method. i relocated it to SaleExample() and that error went away. without really following the flow of your code, it's hard to know if that is where it should be. it needs to be inside some method. in theory, when you're setting up your mposLibobj, that's when you would put the callbacks (in my mind). for some reason, you had the callback in a place that would never be accessed (in my opinion). the compiler thought its location was strange too; that's why it reacted with an error.

also, you have a method: mposLibobj.stratTransaction(trxCompleta). i think you have a typo: "strat" is not a word. if something is looking for "startTransaction", it will fail. if "stratTransaction()" is some method of yours (which i didn't see anyway), then you can spell it anyway you like.

that is as far as i could get without com.ingenico.pclutilities.SslObject being resolved. if you can find that, i'm happy to try again. as i say, i didn't see it in the .aar classes.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i can compile it, but there problems.

normally, if you have an .aar file to include, you simply put it in the libs folder of the project
at the same level as src. i have had no problems with this in the past.

in this case, none of the references can be resolved. in other words,
1) putting the .aar in the libs folder
and
2) adding the .aar to "depends on" option
was not enough.

in order to compile successfully, i had to:
1) move the mposLibobj.setOnTransactionFinishedListener() to the SaleExample() method. it removes the error, but i don't know if it belongs there or somewhere else. i have no way of testing.
2) change "stratTransaction()" to "startTransaction()". it was a typo.
3) extract the PclServiceLib_2.10.00.jar, PclUtilities_2.10.00.jar, and classes.jar from the mposintegrado.aar and copy them to the libs folder. refer to them in the @dependson option:
@DependsOn(values = { "mposintegrado.aar","PclServiceLib_2.10.00.jar", "PclUtilities_2.10.00.jar", "classes.jar" })
4) make a dummy hexStringToByteArray() method. you need one. i didn't see it anywhere. it's easy enough to write or find one.

so, it can be compiled, but i have no idea what happens when you try to run. i also think my solution to the .aar problem is not the correct one. i did what i had to do to make the compiler happy,
but i think there will be problems when you actually try to use the library. i wanted to try to give you something that built without error. maybe you can go from there. i don't know.

i'm going to try to post:

PCLServicio.java
PclServiceLib_2.10.00.jar
PclUtilities_2.10.00.jar
classes.jar
the library and the xml

you will have to look very carefully at my PCLServicio.java to compare it with your original. i am concerned that mposLibobj.setOnTransactionFinishedListener() needs to go somewhere else. perhaps the original code that you're trying to wrap tells you.
and i think the biggest problem is why the mposintegrado.aar does not work with the SLC. i can't answer that. don't forget, if you try to use the library with a b4a test project, you need to reference all the .jars and the .aar (#additionaljar: ...). plus you need to copy them all to your additional libraries folder.
 

Attachments

  • hormaz1.zip
    232.1 KB · Views: 85
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i am afraid we are in different territory now. sorry. it is unclear how you are trying to connect a b4a app to the library.
this line in your library:
public abstract class PCLServicio extends Activity
is what the error you posted is referring to. once you declare the class as abstract, you don't create an instance of it (with new()). now you are going to need a java expert to get you out of this. sorry.
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
There is an example of an App for Android Studio but I don't understand much about Java, I just defend myself a little, I add both the APK and the code in Android Studio which I try to pass to B4A. However, I have a preview of the bookstore that I am putting together but without success. It would be nice if you would look at the sample code I am sending you called 'PclTestApp' and focus on the TestActivity.java class where you are sending data and it is exactly what I need. I also attach the video of the application and how I send the hexadecimal trap by enabling a CheckBox and copying an example frame that is this: FC30DFFF250A304130303237303030309A032203309F2103145700DC010ADFFE530131DFFF2B0131DFFE4006000001234500.

Code Example:

APKs:

Video:

Attach Libraries
 

Attachments

  • Java Libraries.zip
    173.2 KB · Views: 91
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i really cannot imagine what added value you would bring if ingenico already has an app for android. use it. i don't understand what b4a has to do with this.

many apps can be built with android studio with little knowledge of java or even being familiar with android studio! i don't use android studio, but i recently downloaded a project. all i had to do was double click on gradle, and android studio did everything by itself. in the end, i had an app which i deployed to my phone. not my app, not in b4a, but an app that did what i wanted. sounds to me like ingenico has already solved 95% of your problem. just build the project y s'acabó.

it really is important not to try to do monetary transactions with a homemade project. people like ingenico have spent a lot of money and time having their software and hardware certified by credit card issuing companies and banks. i mean A LOT of money. it is too easy to make a mistake, and ingenico or some bank might refuse to do business with you.

i think you are trying to wrap something which, basically, has already been wrapped for you. you need to remove certain parts of the "library" you posted before. it is already an app, not just number of "hooks" that you can use to create an app. you see the difference, right? when i was trying to compile the "library", i didn't spend much time looking at the code. as i look at it now, it is an app. not a library.
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
i really cannot imagine what added value you would bring if ingenico already has an app for android. use it. i don't understand what b4a has to do with this.

many apps can be built with android studio with little knowledge of java or even being familiar with android studio! i don't use android studio, but i recently downloaded a project. all i had to do was double click on gradle, and android studio did everything by itself. in the end, i had an app which i deployed to my phone. not my app, not in b4a, but an app that did what i wanted. sounds to me like ingenico has already solved 95% of your problem. just build the project y s'acabó.

it really is important not to try to do monetary transactions with a homemade project. people like ingenico have spent a lot of money and time having their software and hardware certified by credit card issuing companies and banks. i mean A LOT of money. it is too easy to make a mistake, and ingenico or some bank might refuse to do business with you.

i think you are trying to wrap something which, basically, has already been wrapped for you. you need to remove certain parts of the "library" you posted before. it is already an app, not just number of "hooks" that you can use to create an app. you see the difference, right? when i was trying to compile the "library", i didn't spend much time looking at the code. as i look at it now, it is an app. not a library.
It is a library, and the App is only for testing and I need to integrate the Transaction part to a transport App made by B4A
The ingenico app is only a guide for the developer.
Now, if you can interpret how the data is sent to the Ingenico Dataphone, it would be of great help since with B4A I manage to connect with the Device but it does not understand the way in which I send the data frame. I have tried in many ways but no results, that is why I have come to develop this library.
Thank you really for your time.
God bless you!
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
You might try asking for help with your B4X app, rather than asking for someone to write a library for you.

What code are you using to connect to the device? I haven't seen you post any.
What response are you actually receiving from the device? I haven't seen that.

If you are failing to interact with the device in the most basic way, I don't think a library is going to help.
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
The code I have is only the Bluetooth connection with the device but the data sending format is PCL and that is where I have the problem since the Igenico device recognizes that format.
You might try asking for help with your B4X app, rather than asking for someone to write a library for you.

What code are you using to connect to the device? I haven't seen you post any.
What response are you actually receiving from the device? I haven't seen that.

If you are failing to interact with the device in the most basic way, I don't think a library is going to help.

I regret that the PDF documentation is in Spanish.
that's a lot of information

 

Attachments

  • PCL1.zip
    12.2 KB · Views: 85
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
Bytes are bytes, it doesn't matter if it's PCL, XML or ASCII. If you post your code to connect to the device and show what you get as a response, folks here might be able to help.
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Bytes are bytes, it doesn't matter if it's PCL, XML or ASCII. If you post your code to connect to the device and show what you get as a response, folks here might be able to help.

The code I have is only the Bluetooth connection with the device but the data sending format is PCL and that is where I have the problem since the Igenico device recognizes that format.


I regret that the PDF documentation is in Spanish.
that's a lot of information

I already uploaded it here friend.
I have no response because the device does not recognize what I send it
 
Upvote 0
Top