[SOLVED] Irrlicht Android - nativeEnvJ2C

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
AlfAlien
Posts: 20
Joined: Tue Jan 28, 2014 2:08 pm

[SOLVED] Irrlicht Android - nativeEnvJ2C

Post by AlfAlien »

I ran into problem - my test application displays in LogCat

Code: Select all

com.ellismarkov.irrlicht    Irrlicht    not handled /mnt/sdcard
The problem in the following funciton

Code: Select all

 
void Java_com_ellismarkov_irrlicht_IrrlichtTest_nativeEnvJ2C(JNIEnv* env, jobject defaultObj, jstring jsdcardPath)
{
    char ligne[1024 + 1];
    const char *msg = env->GetStringUTFChars(jsdcardPath, 0);
    gSdCardPath = msg;
    __android_log_print(ANDROID_LOG_INFO, "Irrlicht", "not handled %s", gSdCardPath.c_str()); //=> ERROR IS HERE
    env->ReleaseStringUTFChars(jsdcardPath, msg);
}
 
What this function (nativeEnvJ2C) makes? Why I cannot handle SD card?
Last edited by AlfAlien on Wed Jan 29, 2014 12:52 pm, edited 1 time in total.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Irrlicht Android - nativeEnvJ2C

Post by Nadro »

Which version of Irrlicht do you use? It looks like you're using some unofficial Android port.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
AlfAlien
Posts: 20
Joined: Tue Jan 28, 2014 2:08 pm

Re: Irrlicht Android - nativeEnvJ2C

Post by AlfAlien »

Hello! I use https://gitorious.org/irrlichtandroid, it's based on irrlicht 1.7. I thought it's the only available official port.
This function resides in project/jni/android-activity.cpp. I know that it's native method implementation, just can't understand why we need this function.
Do you know any other irrlicht android ports?
P.S. I finally understood what this function makes - it converts java string (path to SD Card) to native c++ string, then you can use this c++ string in your c++ code.
Last edited by AlfAlien on Thu Jan 30, 2014 2:43 pm, edited 1 time in total.
Nadro
Posts: 1648
Joined: Sun Feb 19, 2006 9:08 am
Location: Warsaw, Poland

Re: Irrlicht Android - nativeEnvJ2C

Post by Nadro »

Hi,

Please check this one (example no. 27 is dedicated for Android):
svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es

Cheers,
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
AlfAlien
Posts: 20
Joined: Tue Jan 28, 2014 2:08 pm

Re: Irrlicht Android - nativeEnvJ2C

Post by AlfAlien »

Thanks! I didn't know about that. It also contains native activity demos - that's great!
Post Reply