Add fallback for Package.installedTime
authors89.jang <s89.jang@samsung.com>
Fri, 28 Apr 2017 08:27:52 +0000 (17:27 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Fri, 12 May 2017 03:17:13 +0000 (03:17 +0000)
Since the native api for getting installed time is available over
API version 4.0, we need fallback for this member when that native api
is not supported.

Change-Id: I56e4be3a8e9491a5ccd8b8b745e890a144faccd7
Signed-off-by: s89.jang <s89.jang@samsung.com>
src/Tizen.Applications.PackageManager/Tizen.Applications/Package.cs

index ae60eed..544409b 100644 (file)
@@ -277,10 +277,18 @@ namespace Tizen.Applications
             {
                 Log.Warn(LogTag, "Failed to get whether package " + pkgId + " is accessible or not");
             }
-            Interop.Package.PackageInfoGetInstalledTime(handle, out package._installedTime);
-            if (err != Interop.PackageManager.ErrorCode.None)
+            try
+            {
+                Interop.Package.PackageInfoGetInstalledTime(handle, out package._installedTime);
+                if (err != Interop.PackageManager.ErrorCode.None)
+                {
+                    Log.Warn(LogTag, "Failed to get installed time of " + pkgId);
+                }
+            }
+            catch (TypeLoadException)
             {
-                Log.Warn(LogTag, "Failed to get installed time of " + pkgId);
+                // To support in API vesion 3.0
+                package._installedTime = 0;
             }
 
             package._certificates = PackageCertificate.GetPackageCertificates(handle);