 
             _initialized = true;
 
+            NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
+            NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onActivate);
+            NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate);
+
             dataArr = event.code.split("_");
             if (dataArr.length == 2) {
                 callbackName = dataArr[1];

                log("ERROR - Extension context is null. Please check if extension.xml is setup correctly.");
                return;
            }
            _context.addEventListener(StatusEvent.STATUS, onStatus);

            NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvoke);
            NativeApplication.nativeApplication.addEventListener(Event.ACTIVATE, onActivate);
            NativeApplication.nativeApplication.addEventListener(Event.DEACTIVATE, onDeactivate);

            _instance = this;
        }

    {
        if (isSupported && _context != null) {

            if(!_initialized){
                _context.addEventListener(StatusEvent.STATUS, onStatus);

                _context.call("setNativeLogEnabled", Facebook.nativeLogEnabled);
                log("ANE Facebook version: " + VERSION);
                // iOS is synchronous but we will simulate async to have consistent API
                _context.call("initFacebook", appID, getNewCallbackName(onInitialized));
            } else {
                log("Already initialized!");
            }
        } else {

            log("Can't initialize extension! Unsupported platform or context couldn't be created!")
