PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV Mobile 2024 → PROBLEM WITH NATIVE JAVA CODE
PROBLEM WITH NATIVE JAVA CODE
Iniciado por lorenzo, dez., 15 2013 6:17 PM - 13 respostas
Publicado em dezembro, 15 2013 - 6:17 PM
Hi,

I tried to use the java code in windev mobile but when I call the procedure always returns the following error:
"The call to native code is not available."

The procedure is very simple:

public static int NewProcedure()
{
return 1;
}

can someone help me?

thanks
Membro registado
4.520 mensagems
Publicado em maio, 14 2014 - 6:32 PM
//ExecRun - Funcional - Perfeito

import android.app.Activity;
import android.content.Intent;
import java.lang.*;
import android.util.*;
import java.lang.Exception;
import android.util.Log;

public static boolean ExecRun(String Aplicativo){
try {

if (Aplicativo == null){
return false;
}
else{
Intent Apk = getActiviteEnCours().getPackageManager().getLaunchIntentForPackage(Aplicativo);
getActiviteEnCours().startActivity(Apk);
return true;
}

}
catch(Exception e) {
Log.e("WM",e.toString());
return false;
}
}
Membro registado
4.520 mensagems
Publicado em maio, 14 2014 - 6:33 PM
//Simula o click na Tecla Home do Android

import android.app.Activity;
import android.content.Intent;
import java.lang.*;
import android.util.*;
import java.lang.Exception;
import android.util.Log;

public static void KeyHome()
{
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
getActiviteEnCours().startActivity(startMain);
}
Membro registado
4.520 mensagems
Publicado em maio, 14 2014 - 6:33 PM
//Desativar Bloqueio de Tela, protecao de tela, hibernar
import android.app.Activity;
import android.view.Window;
import android.view.WindowManager.LayoutParams;

public static void DesativarBloqueioTela(boolean keepScreenOn) {
Activity xa = getCurrentActivity();
Window xw = xa.getWindow();
if (keepScreenOn == true) {
xw.addFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
} else {
xw.clearFlags(android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
}
Membro registado
4.520 mensagems
Publicado em maio, 14 2014 - 6:34 PM
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
import android.provider.Settings.Secure;

public static String CelularGetDeviceId()
{

TelephonyManager tm;
tm = (TelephonyManager)getApplicationContext().getSystemService(Context.TELEPHONY_SERVICE);
String num = tm.getDeviceId();

if (num == ""){
num = "Celular sem chip instalado";
}

else if (num == null){
num = "Celular sem chip instalado";
}

return(num);

}
Membro registado
4.520 mensagems
Publicado em maio, 14 2014 - 6:34 PM
//Funcionando abre janela para ajustar as configuracoes
import android.app.Activity;
import java.lang.*;
import android.util.*;
import java.lang.Exception;
import android.util.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

public static void HabilitaWifiGps()
{
Intent i = new
Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
getActiviteEnCours().startActivity(i);
}
Publicado em maio, 15 2014 - 2:06 AM
Como llamo al procedimiento en java?

How to call java procedure?
Publicado em maio, 15 2014 - 2:14 AM
Como llamo a un procedimiento en Java?

How to call a java procedure?
Publicado em maio, 15 2014 - 7:30 AM
Resolviste el problema: "The call to native code is not available."

a mi me sale lo mismo y no se como resolverlo.
Membro registado
4.520 mensagems
Publicado em maio, 15 2014 - 2:02 PM
//in screem use my code global:


//Execute never black screen if open app.

DesativarBloqueioTela(true)



//Execute disable never black screen if open app.

DesativarBloqueioTela(false)
Membro registado
4.520 mensagems
Publicado em maio, 15 2014 - 2:04 PM
//Or button code:

KeyHome()


//is code up descript examples sends ok
Publicado em maio, 31 2014 - 12:05 AM
Hola. El simulador de WM no puede ejecutar codigo java. Debes probarlo en un terminal real o en el emulador de Android.


Rubén
Membro registado
4.520 mensagems
Publicado em junho, 02 2014 - 1:36 PM
This I know

use in simulator inibe code error:

if simulatormode () = false
KeyHome()
end

The problem is how to use and extend in Place in WINDEV.

That I do not know.

I spent above examples of codes that I developed with WINDEV Mobile and they are functional. The great difficulty implemetar. Yard and new classes in code Windev Mobile'm finding that when the r.class, creating classes, subclasses and extend in Place is necessary because the commands are not recognized and did not find examples. If you have any example that allows to perform these tasks in WINDEV Mobile I appreciate now.

Att

Adriano
Publicado em fevereiro, 19 2021 - 10:55 PM
What a great contribution, I would like to know if you know how I could return a variable to use it in the code of a windev mobile window?