javaextensions/wma/mms/src.s60/mmsinstallerpluginjni.cpp
changeset 78 71ad690e91f5
equal deleted inserted replaced
72:1f0034e370aa 78:71ad690e91f5
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "logger.h"
       
    20 #include "jstringutils.h"
       
    21 #include <mmsapplicationadapter.h>
       
    22 #include "com_nokia_mj_impl_mms_MMSInstallerPlugin.h"
       
    23 
       
    24 //using namespace java::wma;
       
    25 
       
    26 /*
       
    27  * Class:     com_nokia_mj_impl_mms_MMSInstallerPlugin
       
    28  * Method:    _markForUnregister
       
    29  * Signature: (Ljava/lang/String;)I
       
    30  */
       
    31 JNIEXPORT jint JNICALL Java_com_nokia_mj_impl_mms_MMSInstallerPlugin__1unregisterFromMMSEngine
       
    32 (JNIEnv* aJni, jobject /*aPeer*/, jstring aUri)
       
    33 {
       
    34     JELOG2(EWMA);
       
    35     TRAPD(Error,
       
    36     {
       
    37        CActiveScheduler* activeScheduler = new(ELeave) CActiveScheduler();
       
    38        CleanupStack::PushL(activeScheduler);
       
    39        CActiveScheduler::Install(activeScheduler);
       
    40        CMmsApplicationAdapter* mmsApplicationAdapter = CMmsApplicationAdapter::NewL();
       
    41        CleanupStack::PushL(mmsApplicationAdapter);
       
    42        JStringUtils applicationId(*aJni,aUri);
       
    43        LOG1(EWMA,EInfo,"_markForUnregister - ApplicationId = %S",applicationId.Ptr());
       
    44        TBool isRegistered = mmsApplicationAdapter->RegisteredL(applicationId);
       
    45        if (isRegistered)
       
    46        { 
       
    47           LOG(EWMA,EInfo,"Unregistering from MMSEngine");
       
    48           mmsApplicationAdapter->UnregisterL(applicationId);
       
    49        }
       
    50        CleanupStack::PopAndDestroy(mmsApplicationAdapter);
       
    51        CleanupStack::PopAndDestroy(activeScheduler);
       
    52     });
       
    53     LOG1(EWMA,EInfo,"Unregistering status : %d",Error);
       
    54     return Error;
       
    55 }