Esempio n. 1
0
        public static bool IsServiceRunning(System.Type typeIntentClass, Context context)
        {
            try
            {
                ActivityManager manager = (ActivityManager)context.GetSystemService(Context.ActivityService);

                foreach (var service in manager.GetRunningServices(int.MaxValue))
                {
                    if (service.Service.ClassName.Equals(Java.Lang.Class.FromType(typeIntentClass).CanonicalName))
                    {
                        return(true);
                    }
                }

                return(false);
            }
            catch (System.Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(HearServices), ex);
                #endregion

                return(false);
            }
            finally { }
        }
Esempio n. 2
0
        static Info()
        {
            try
            {
                Context context = Android.App.Application.Context;

                AppCenterId                   = context.Resources.GetString(Resource.String.AppCenterId);
                FileNameSettings              = context.Resources.GetString(Resource.String.name_settings_file);
                ApplicationName               = context.Resources.GetString(Resource.String.app_name);
                Name                          = context.Resources.GetString(Resource.String.ChannelNameRam);
                Description                   = context.Resources.GetString(Resource.String.ChannelDescriptionRam);
                Chanlelid                     = context.Resources.GetString(Resource.String.ChannelIDRam);
                NotificationId                = context.Resources.GetInteger(Resource.Integer.IntegerNotificationRamID);
                IntentActionAlarm             = context.Resources.GetString(Resource.String.IntentActionAlarm);
                IntentActionUpdateSettings    = context.Resources.GetString(Resource.String.IntentActionUpdateSettings);
                IntentActionStartService      = context.Resources.GetString(Resource.String.IntentActionStartServiceRam);
                IntentActionStopService       = context.Resources.GetString(Resource.String.IntentActionStopServiceRam);
                IntentActionRestartServiceRam = context.Resources.GetString(Resource.String.IntentActionRestartServiceRam);
                ActionMainActivity            = context.Resources.GetString(Resource.String.ActionMainActivity);
                ServiceStartedKey             = context.Resources.GetString(Resource.String.ServiceStartedKey);
                ServiceBoundedKey             = context.Resources.GetString(Resource.String.ServiceBoundedKey);
                BroadcastMessengeKey          = context.Resources.GetString(Resource.String.BroadcastMessengeKey);
            }
            catch (System.Exception ex)
            {
                #region Logging
                LogRuntimeAttribute.InLogFiles(typeof(Info), ex);
                #endregion
            }
            finally { }
        }