Exemple #1
0
        /// <summary>
        /// Retrieves all the capability information of the account provider.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <privilege>http://tizen.org/privilege/account.read</privilege>
        /// <feature>http://tizen.org/feature/account</feature>
        /// <returns>
        /// The list of capability information.
        /// </returns>
        /// <exception cref="InvalidOperationException">In case of any DB error.</exception>
        /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
        public IEnumerable <string> GetAllCapabilities()
        {
            List <string> capabilities = new List <string>();
            AccountError  res;

            Interop.AccountProvider.AccountProviderFeatureCallback callback = (string appId, string key, IntPtr data) =>
            {
                capabilities.Add(key);
                return(true);
            };

            res = (AccountError)Interop.AccountProvider.GetAccountProviderFeatures(Handle, callback, IntPtr.Zero);
            if (res != AccountError.None)
            {
                throw AccountErrorFactory.CreateException(res, "Failed to GetAllCapabilities for AccountProvider");
            }

            return(capabilities);
        }
Exemple #2
0
        /// <summary>
        /// Retrieves capability information with the application ID.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        /// <param name="appId">The application ID.</param>
        /// <returns> Capability information list for the given appId.</returns>
        /// <privilege>http://tizen.org/privilege/account.read</privilege>
        /// <feature>http://tizen.org/feature/account</feature>
        /// <exception cref="InvalidOperationException">In case of any DB error or record not found for the given application ID.</exception>
        /// <exception cref="ArgumentException"> In case of an invalid parameter.</exception>
        /// <exception cref="UnauthorizedAccessException"> In case of privilege not defined.</exception>
        /// <exception cref="NotSupportedException">The required feature is not supported.</exception>
        public static IEnumerable <string> GetFeaturesByAppId(string appId)
        {
            List <string> features = new List <string>();

            Interop.AccountProvider.AccountProviderFeatureCallback callback = (string applicationId, string key, IntPtr userData) =>
            {
                features.Add(key);
                return(true);
            };

            AccountError err = (AccountError)Interop.AccountProvider.GetAccountProviderFeaturesByAppId(callback, appId, IntPtr.Zero);

            if (err != AccountError.None)
            {
                throw AccountErrorFactory.CreateException(err, "Failed to GetAccountProviderFeaturesByAppId");
            }

            return((IEnumerable <string>)features);
        }