CCNotificationCenter::sharedNotificationCenter()->postNotification not working

Hi Here is my code using cocos2d-X

void notify(){
    CCLog("THE jni call is successfull 2");
     CCNotificationCenter::sharedNotificationCenter()->postNotification(MY_SCREEN_RES,NULL);
}

extern "C" {
    void Java_com_nbs_test_JNITest_printSomething(JNIEnv *, jclass){
        CCLog("THE jni call is successfull");
        notify();
    }
}

The jni call is working fine, printing the message. In the constructor of my scene i use the following code

PingoScreen::PingoScreen() {

    if (!CCLayer::init()) {
        return;
    }

     CCNotificationCenter::sharedNotificationCenter()->addObserver(
                            this,
                            callfuncO_selector( PingoScreen::printSomethingInCpp),
                            "hello",
                            NULL);

My listner function is quite simple

void PingoScreen::printSomethingInCpp(){
    CCLog("Its goton hererew---------------------------->");
}

This is never getting called. What am i doing wrong ?

Kind Regards

MY_SCREEN_RES is a string “hello” ?

yes

#define MY_SCREEN_RES “hello”

printSomethingInCpp(){ <<— here is your problem method should look like

printSomethingInCpp(CCObject* pObject){

tried this still nothing. :frowning:

any other help anyone ?

You must be posting before creating the listener.

My Listener is created in the constructor. I am posting from a JNI function. Can i assume JNI function is created before the constrcutor ? If so what function should i move the creation to ?

I have tried anything. The JNI call into C seems to happen before any init constructor or anything is called ? What can i do so that a JNI call end up in my scene ?