summaryrefslogtreecommitdiff
path: root/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs')
-rwxr-xr-x[-rw-r--r--]Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs b/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs
index ea2dd74..c99c04d 100644..100755
--- a/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs
+++ b/Tizen.Applications.Common/Tizen.Applications/ApplicationManager.cs
@@ -16,6 +16,7 @@
using System;
using System.Collections.Generic;
+using System.Runtime.InteropServices;
using System.Threading.Tasks;
namespace Tizen.Applications
@@ -399,6 +400,48 @@ namespace Tizen.Applications
_eventHandle = IntPtr.Zero;
}
}
+
+ /// <summary>
+ /// Gets the information of the recent applications.
+ /// </summary>
+ /// <returns>Returns a dictionary containing all recent application info.</returns>
+ /// <exception cref="InvalidOperationException">Thrown when failed because of invalid operation</exception>
+ public static IEnumerable<RecentApplicationInfo> GetRecentApplications()
+ {
+ Interop.ApplicationManager.ErrorCode err = Interop.ApplicationManager.ErrorCode.None;
+
+ List<RecentApplicationInfo> result = new List<RecentApplicationInfo>();
+ IntPtr table;
+ int nrows, ncols;
+
+ err = Interop.ApplicationManager.RuaHistoryLoadDb(out table, out nrows, out ncols);
+ if (err != Interop.ApplicationManager.ErrorCode.None)
+ {
+ throw ApplicationManagerErrorFactory.GetException(err, "Failed to load a table for the recent application list.");
+ }
+
+ for (int row = 0; row < nrows; ++row)
+ {
+ Interop.ApplicationManager.RuaRec record;
+
+ err = Interop.ApplicationManager.RuaHistoryGetRecord(out record, table, nrows, ncols, row);
+ if (err != Interop.ApplicationManager.ErrorCode.None)
+ {
+ throw ApplicationManagerErrorFactory.GetException(err, "Failed to get record.");
+ }
+
+ RecentApplicationInfo info = new RecentApplicationInfo(record);
+ result.Add(info);
+ }
+
+ err = Interop.ApplicationManager.RuaHistoryUnLoadDb(ref table);
+ if (err != Interop.ApplicationManager.ErrorCode.None)
+ {
+ throw ApplicationManagerErrorFactory.GetException(err, "Failed to unload a table for the recent application list.");
+ }
+
+ return result;
+ }
}
internal static class FilterExtension