PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM22] 3rd party java libraries
[WM22] 3rd party java libraries
Débuté par Robert, 21 mar. 2018 15:36 - 6 réponses
Membre enregistré
105 messages
Posté le 21 mars 2018 - 15:36
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?
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 21 mars 2018 - 21:05
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
Membre enregistré
105 messages
Posté le 21 mars 2018 - 21:51
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.
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 21 mars 2018 - 22:45
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
Posté le 31 mai 2018 - 20:36
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?
Membre enregistré
8 messages
Posté le 31 mai 2018 - 21:01
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
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 01 juin 2018 - 18:13
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