PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV Mobile 2024 → [WM22] 3rd party java libraries
[WM22] 3rd party java libraries
Started by Robert, Mar., 21 2018 3:36 PM - 6 replies
Registered member
105 messages
Posted on March, 21 2018 - 3:36 PM
Silly question, that I can't seem to locate an answer to.

I have a 3rd party java library (.jar file) from a vendor. How can I include this in a WM22 android application so that I can use the functions within?
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on March, 21 2018 - 9:05 PM
First Thing is that when you generate the apk theres a part when you can import those .jar
Then you need to import it on your java code.

I think is on the six part of the generating

use this link
https://help.windev.com/en-US/…

There on the 15th part it tells you how to import because you have the version 22 so they add some new stuff that I don't have because I use WM20
Registered member
105 messages
Posted on March, 21 2018 - 9:51 PM
Thanks for pointing me that way. That helps.

Now I just have to figure out how to make it work. I'm definitely a noob when it comes to Java code.
And it doesn't appear that I can just copy/paste the example code they give into WM and have it work.
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on March, 21 2018 - 10:45 PM
Hi Robert

Well I use java code the good part it's you can call Windev global procedures the bad thing is that you can't literally copy and paste the java code because you only could run methods or Procedures on java you run that method and that's all in there doesn't exists class or constuctor or objects to call methods.

Also you can't run the procedure java code with windev on PC you need to generate the apk and then run on your android device.

That's all I know my fellow developer.

best regards Robert
Posted on May, 31 2018 - 8:36 PM
Hi Jose

I need connect with printer blueetohh SDK

The documentation specifies classes such as:

private class ConnStateHandler extends Handler {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
Bundle data = msg.getData();
switch (data.getInt("flag")) {
/*The FLAG_STATE_CHANGE indicat that connection state will change when the Handler received message*/
case Contants.FLAG_STATE_CHANGE:
/*This Case indicate the current connection state that include four state and you can find a state from the Contants Class
UNCONNECTED、
CONNECTED_BY_BLUETOOTH、
CONNECTED_BY_USB、
CONNECTED_BY_WIFI) */
int state = data.getInt("state");
//As for receiving state , you can write corresponding Code in here

break;


/*The FLAG_FAIL_CONNECT indicat that connection is Failed when the Handler received message*/
case Contants.FLAG_FAIL_CONNECT:
//As for receiving state , you can write corresponding Code in here

break;

/*The FLAG_FAIL_CONNECT indicat that connection is Successful when the Handler received message*/
case Contants.FLAG_SUCCESS_CONNECT:
//As for receiving state , you can write corresponding Code in here

break;
}
}
}



how can I use this without classes?
Registered member
8 messages
Posted on May, 31 2018 - 9:01 PM
Hi Jose

I need connect with printer blueetohh SDK

The documentation specifies classes such as:

private class ConnStateHandler extends Handler {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
Bundle data = msg.getData();
switch (data.getInt("flag")) {
/*The FLAG_STATE_CHANGE indicat that connection state will change when the Handler received message*/
case Contants.FLAG_STATE_CHANGE:
/*This Case indicate the current connection state that include four state and you can find a state from the Contants Class
UNCONNECTED、
CONNECTED_BY_BLUETOOTH、
CONNECTED_BY_USB、
CONNECTED_BY_WIFI) */
int state = data.getInt("state");
//As for receiving state , you can write corresponding Code in here

break;


/*The FLAG_FAIL_CONNECT indicat that connection is Failed when the Handler received message*/
case Contants.FLAG_FAIL_CONNECT:
//As for receiving state , you can write corresponding Code in here

break;

/*The FLAG_FAIL_CONNECT indicat that connection is Successful when the Handler received message*/
case Contants.FLAG_SUCCESS_CONNECT:
//As for receiving state , you can write corresponding Code in here

break;
}
}
}



how can I use this without classes?

--
Jesus Madrigal
JESMAD Soluciones TICS
Registered member
498 messages
Popularité : +8 (8 votes)
Posted on June, 01 2018 - 6:13 PM
Hi Jesus I have some questions for you

What version of windev mobile do you use?

Also the code that you use of java can't be put it on Windev Mobile because you can but when you need to use some variables of that class or method it won't work at all so then use this

http://forum.pcsoft.fr/fr-FR/pcsoft.br.windev/1398-imprimir-mobile-print-from-mobile/read.awp

I use this example of this forum but theres a trick

I use the exact same code but for some reason to print something you need to send a message.

just follow all of he said in that thread but in this part in particular it said this:

s_socketImpresora is string
s_socketImpresora = PRINT_ConnectarDesconectar("MPD2",True,"")
IF Left(s_socketImpresora,4) = "SOCK" THEN //Conectado
PRINT_Imprimir(s_socketImpresora,"HOLA MUNDO Con Windev Mobile")
PRINT_ConnectarDesconectar("",False,s_socketImpresora)
ELSE
Info(s_socketImpresora)
END



I use the exact same code but it don't work but for some reason I put something like

s_socketImpresora is string
s_socketImpresora = PRINT_ConnectarDesconectar("MPD2",True,"")
IF Left(s_socketImpresora,4) = "SOCK" THEN //Conectado
PRINT_Imprimir(s_socketImpresora,"HOLA MUNDO Con Windev Mobile")
Info("Print pleaseeeeee")
PRINT_ConnectarDesconectar("",False,s_socketImpresora)
ELSE
Info(s_socketImpresora)
END



and then it work!


it has some trick this work on Windev Mobile 20.
Just let me know if you have problems

Best Regards
Jose