[DllImport(Libraries.PackageManager, EntryPoint = "package_manager_clear_data_dir")]
internal static extern ErrorCode PackageManagerClearDataDir(string packageId);
+ [DllImport(Libraries.PackageManager, EntryPoint = "package_manager_clear_user_data_with_path")]
+ internal static extern ErrorCode PackageManagerClearUserDataWithPath(string packageId, String filePath);
+
[DllImport(Libraries.PackageManager, EntryPoint = "package_manager_filter_create")]
internal static extern ErrorCode PackageManagerFilterCreate(out IntPtr handle);
}
/// <summary>
+ /// Removes a file or directory specified with <paramref name="path"/> from user data internal storage for the application.
+ /// </summary>
+ /// <param name="packageId">ID of the package.</param>
+ /// <param name="path">The path of the file or directory in the package user data folder.</param>
+ /// <exception cref="OutOfMemoryException">Thrown when there is not enough memory to continue the execution of the method.</exception>
+ /// <exception cref="System.IO.IOException">Thrown when the method failed due to an internal IO error.</exception>
+ /// <exception cref="UnauthorizedAccessException">Thrown when an application does not have the privilege to access this method.</exception>
+ /// <exception cref="SystemException">Thrown when the method failed due to an internal system error.</exception>
+ /// <privilege>http://tizen.org/privilege/packagemanager.admin</privilege>
+ /// <privlevel>platform</privlevel>
+ /// <since_tizen> 11 </since_tizen>
+ public static void ClearUserData(string packageId, string path)
+ {
+ Interop.PackageManager.ErrorCode err = Interop.PackageManager.PackageManagerClearUserDataWithPath(packageId, path);
+ if (err != Interop.PackageManager.ErrorCode.None)
+ {
+ Log.Warn(LogTag, string.Format("Failed to clear user data for {0} of {1}. err = {2}", path, packageId, err));
+ throw PackageManagerErrorFactory.GetException(err, "Failed to clear user data");
+ }
+ }
+
+ /// <summary>
/// Retrieves the package information of all installed packages.
/// </summary>
/// <returns>Returns the list of packages.</returns>