Fix ApplicationManager.RegisterApplicationChangedEvent
authors89.jang <s89.jang@samsung.com>
Fri, 17 Mar 2017 07:55:13 +0000 (16:55 +0900)
committers89.jang <s89.jang@samsung.com>
Fri, 17 Mar 2017 07:57:12 +0000 (16:57 +0900)
Change-Id: Ic8ac0b9c80cb5731cee8c86220afecf4ad279f9a
Signed-off-by: s89.jang <s89.jang@samsung.com>
src/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs

index 9a86c18..1644e16 100644 (file)
@@ -323,7 +323,13 @@ namespace Tizen.Applications
             {
                 if (contextHandle == IntPtr.Zero) return;
 
-                ApplicationRunningContext context = new ApplicationRunningContext(contextHandle);
+                IntPtr clonedHandle = IntPtr.Zero;
+                err = Interop.ApplicationManager.AppContextClone(out clonedHandle, contextHandle);
+                if (err != Interop.ApplicationManager.ErrorCode.None)
+                {
+                    throw ApplicationManagerErrorFactory.GetException(err, "Failed to register the application context event.");
+                }
+                ApplicationRunningContext context = new ApplicationRunningContext(clonedHandle);
                 if (state == Interop.ApplicationManager.AppContextEvent.Launched)
                 {
                     s_launchedHandler?.Invoke(null, new ApplicationLaunchedEventArgs { ApplicationRunningContext = context });