/// <summary>
        /// On create simply detect some of our managers
        /// </summary>
        public override void OnCreate()
        {
            base.OnCreate();
            //Find our audio and notificaton managers
            audioManager = (AudioManager)GetSystemService(AudioService);
            wifiManager = (WifiManager)GetSystemService(WifiService);

			remoteComponentName = new ComponentName(PackageName, new RemoteControlBroadcastReceiver().ComponentName);
        }
		public void OnServiceDisconnected(ComponentName name)
		{
			Log.Debug(TAG, $"OnServiceDisconnected {name.ClassName}");
			IsConnected = false;
			Binder = null;
			mainActivity.timestampMessageTextView.SetText(Resource.String.service_not_connected);
		}
        internal void InitMediaSession(string packageName, MediaServiceBinder binder)
        {
            try
            {
                if (mediaSessionCompat == null)
                {
                    Intent nIntent = new Intent(applicationContext, typeof(MediaPlayer));
                    PendingIntent pIntent = PendingIntent.GetActivity(applicationContext, 0, nIntent, 0);

                    RemoteComponentName = new ComponentName(packageName, new RemoteControlBroadcastReceiver().ComponentName);
                    mediaSessionCompat = new MediaSessionCompat(applicationContext, "XamarinStreamingAudio", RemoteComponentName, pIntent);
                    mediaControllerCompat = new MediaControllerCompat(applicationContext, mediaSessionCompat.SessionToken);
                    NotificationManager = new MediaNotificationManagerImplementation(applicationContext, CurrentSession.SessionToken, _serviceType);
                }
                mediaSessionCompat.Active = true;
                mediaSessionCompat.SetCallback(binder.GetMediaPlayerService<MediaServiceBase>().AlternateRemoteCallback ?? new MediaSessionCallback(this));
                mediaSessionCompat.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);
                _packageName = packageName;
                _binder = binder;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Service = IInAppBillingServiceStub.AsInterface (service);

            string packageName = _activity.PackageName;

            try {

                int response = Service.IsBillingSupported (Xamarin.InAppBilling.Billing.APIVersion, packageName, "inapp");
                if (response != BillingResult.OK) {
                    Connected = false;
                }

                // check for v3 subscriptions support
                response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.Subscription);
                if (response == BillingResult.OK) {

                    Connected = true;
                    RaiseOnConnected (Connected);

                    return;
                } else {

                    Connected = false;
                }

            } catch (Exception ex) {

                Connected = false;
            }
        }
        public void OnServiceConnected(ComponentName name, Android.OS.IBinder service)
        {
            Logger.Debug ("Billing service connected.");
            Service = IInAppBillingServiceStub.AsInterface (service);

            string packageName = _activity.PackageName;

            try {
                Logger.Debug ("Checking for in-app billing V3 support");

                int response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.InApp);
                if (response != BillingResult.OK) {
                    Connected = false;
                }

                Logger.Debug ("In-app billing version 3 supported for {0}", packageName);

                // check for v3 subscriptions support
                response = Service.IsBillingSupported (Billing.APIVersion, packageName, ItemType.Subscription);
                if (response == BillingResult.OK) {
                    Logger.Debug ("Subscriptions AVAILABLE.");
                    Connected = true;
                    RaiseOnConnected (Connected);

                    return;
                } else {
                    Logger.Debug ("Subscriptions NOT AVAILABLE. Response: {0}", response);
                    Connected = false;
                }

            } catch (Exception ex) {
                Logger.Debug (ex.ToString ());
                Connected = false;
            }
        }
        public void OnServiceConnected(ComponentName name, IBinder binder)
        {
            _binder = binder as AndroidSensusServiceBinder;

            if (_binder != null && ServiceConnected != null)
                ServiceConnected(this, new AndroidServiceConnectedEventArgs(_binder));
        }
		public void OnServiceConnected (ComponentName name, IBinder service)
		{
			Service =   IAdditionServiceStub.AsInterface(service);
			_activity.Service = (IAdditionService) Service;
			_activity.IsBound = Service != null;

		}
Exemple #8
0
 public override void OnStart(Intent intent, int startId)
 {
     RemoteViews updateViews = buildUpdate (this);
     ComponentName thisWidget = new ComponentName(this, "classicphone.ClassicPhoneWidget");
     AppWidgetManager manager = AppWidgetManager.GetInstance (this);
     manager.UpdateAppWidget (thisWidget, updateViews);
 }
Exemple #9
0
        public override void OnReceive (Context context, Intent intent)
        {
            var comp = new ComponentName (context,
                           Java.Lang.Class.FromType (typeof(GcmService)));
            StartWakefulService (context, (intent.SetComponent (comp)));

            ResultCode = Result.Ok;
        }
Exemple #10
0
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     if (service is CompassServiceBinder)
     {
         _compassServiceBinder = (CompassServiceBinder)service;
         OpenOptionsMenu();
     }
 }
		public void OnServiceConnected (ComponentName name, IBinder service)
		{
			var serviceBinder = service as StepServiceBinder;
			if (serviceBinder != null) {
				activity.Binder = serviceBinder;
				activity.IsBound = true;
			}
		}
Exemple #12
0
            public void OnServiceDisconnected(ComponentName name)
            {
                IsPlayerBound = false;

                if (_audioPlaybackBinder.IsBinderAlive)
                    _audioPlaybackBinder.Dispose();
                _audioPlaybackBinder = null;
            }
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     var mediaPlayerServiceBinder = service as MediaPlayerServiceBinder;
     if (mediaPlayerServiceBinder != null)
     {
        instance.OnServiceConnected(mediaPlayerServiceBinder);
     }
 }
		public void OnServiceConnected (ComponentName name, IBinder service)
		{
			DataSyncBinderServiceProperty = service as DataSyncBinderService;
			this.IsBackgroundSyncBound = true;
			Task.Run (() => {
				DataSyncBinderServiceProperty.Service.SyncData (App.WorkoutCreatorContext.StaffMember.GymID);
			});

		}
Exemple #15
0
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            playbackBinder = service as PlaybackBinder;
              if (playbackBinder == null) {
            throw new InvalidOperationException("Cannot bind to any service other than " + nameof(PlaybackService));
              }

              OnPlaybackServiceBound();
        }
		/// <summary>
		/// This is called when the connection with the service has been established.
		/// </summary>
		/// <param name="name">Name.</param>
		/// <param name="service">Service.</param>
		public void OnServiceConnected(ComponentName name, IBinder service)
		{
			LocationServiceBinder serviceBinder = service as LocationServiceBinder;

			if (serviceBinder != null) {
				this.binder = serviceBinder;
				ConnectionChanged(this, new ServiceConnectionEventArgs(true));
			}
		}
		public void OnServiceConnected (ComponentName name, IBinder service)
		{
            var serviceBinder = service as ServiceBinder;
			if (serviceBinder != null) {
                Binder = serviceBinder;
                Binder.IsBound = true;
				ServiceConnected(this, new ServiceConnectedEventArgs { Binder = service } );
			}
		}
		public override void OnStart (Intent intent, int startId)
		{
			// Build the widget update for today
			RemoteViews updateViews = buildUpdate (this);

			// Push update for this widget to the home screen
			ComponentName thisWidget = new ComponentName (this, Java.Lang.Class.FromType (typeof (WordWidget)).Name);
			AppWidgetManager manager = AppWidgetManager.GetInstance (this);
			manager.UpdateAppWidget (thisWidget, updateViews);
		}
		public override void OnStart (Intent intent, int startId)
		{
			// Build the widget update for today
			RemoteViews updateViews = buildUpdate (this);

			// Push update for this widget to the home screen
			ComponentName thisWidget = new ComponentName (this, "simplewidget.WordWidget");
			AppWidgetManager manager = AppWidgetManager.GetInstance (this);
			manager.UpdateAppWidget (thisWidget, updateViews);
		}
		public override void OnServiceConnected(ComponentName name, IBinder service)
		{
			var binder = service as AudioRecorderBinder;
			if (binder == null) return;

			if (Connectable == null) return;

			Connectable.RecorderBound = true;
			Connectable.OnServiceBound(binder);
		}
                public void OnServiceConnected( ComponentName name, IBinder serviceBinder )
                {
                    Rock.Mobile.Util.Debug.WriteLine( "OnServiceConnected - We are binding" );

                    AudioServiceBinder binder = serviceBinder as AudioServiceBinder;
                    if ( binder != null )
                    {
                        ConnectionFragment.ServiceConnected( binder );
                    }
                }
        public void OnServiceDisconnected(ComponentName name)
        {
            if (_binder != null)
            {
                if (ServiceDisconnected != null)
                    ServiceDisconnected(this, new AndroidServiceConnectedEventArgs(_binder));

                _binder.SensusServiceHelper = null;
            }
        }
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            ComputeServiceBinder compSvcBinder = (ComputeServiceBinder) service;

            if (compSvcBinder != null) {
                this.binder = (ComputeServiceBinder)service;
                this.activity.binder = this.binder;
                this.activity.binderSet = true;

            }
        }
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            ControllerServiceBinder compSvcBinder = (ControllerServiceBinder)service;

            if (compSvcBinder != null) {
                this.binder = (ControllerServiceBinder)service;
                App.SetServiceBinder(this.binder);
              //  this.app.binderSet = true;

            }
        }
	    public override void SetBadge(int count) {
	        var intent = new Intent("com.htc.launcher.action.UPDATE_SHORTCUT");
	        intent.PutExtra("packagename", GetPackageName());
	        intent.PutExtra("count", count);
			mContext.SendBroadcast (intent);

	        var setNotificationIntent = new Intent("com.htc.launcher.action.SET_NOTIFICATION");
	        var componentName = new ComponentName(GetPackageName(), GetMainActivityClassName());
	        setNotificationIntent.PutExtra("com.htc.launcher.extra.COMPONENT", componentName.FlattenToShortString());
	        setNotificationIntent.PutExtra("com.htc.launcher.extra.COUNT", count);
	        mContext.SendBroadcast(setNotificationIntent);
	    }
		public void OnServiceDisconnected (ComponentName name)
		{
			if (activityA != null) {
				activityA.OnUnBind ();
				activityA.service.MainActivity = null;
			} else {
				activityB.OnUnBind ();
				activityB.service.ChatActivity = null;
			}
			activityA.service = null;
			activityB.service = null;
		}
Exemple #27
0
        public override void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
        {
            Log.Info(App.Tag, "In MainWidget.OnUpdate()");

            var remoteViews = new RemoteViews(context.PackageName, Resource.Layout.mainWidget);
            var thisWidget = new ComponentName(context, this.Class);

            Intent intent = new Intent(context, typeof(WidgetService));
            PendingIntent pendingIntent = PendingIntent.GetService(context, 0, intent, PendingIntentFlags.UpdateCurrent);
            remoteViews.SetOnClickPendingIntent(Resource.Id.MyButton, pendingIntent);

            appWidgetManager.UpdateAppWidget(thisWidget, remoteViews);
        }
Exemple #28
0
        private void SetSyncWhenNetworkPresent (bool enable)
        {
            var receiver = new ComponentName (context, Java.Lang.Class.FromType (typeof(SyncOnNetworkPresentChangeReceiver)));
            var setting = context.PackageManager.GetComponentEnabledSetting (receiver);

            if (enable) {
                if (setting != ComponentEnabledState.Enabled)
                    context.PackageManager.SetComponentEnabledSetting (receiver, ComponentEnabledState.Enabled, ComponentEnableOption.DontKillApp);
            } else {
                if (setting == ComponentEnabledState.Enabled)
                    context.PackageManager.SetComponentEnabledSetting (receiver, ComponentEnabledState.Disabled, ComponentEnableOption.DontKillApp);
            }
        }
        public ComponentNameBuilder(ComponentName name)
        {
            if (name == null)
                return;

            this.Name = name.Name;
            this.Version = name.Version;
            this.Culture = name.Culture;
            this.Architecture = name.Architecture;
            this.PublicKey = name.GetPublicKey();
            this.PublicKeyToken = name.GetPublicKeyToken();
            this.Hash = name.Hash;
        }
		// This gets called when a client tries to bind to the Service with an Intent and an 
		// instance of the ServiceConnection. The system will locate a binder associated with the 
		// running Service 
		public void OnServiceConnected (ComponentName name, IBinder service)
		{
			// cast the binder located by the OS as our local binder subclass
			TaskBinder serviceBinder = service as TaskBinder;
			if (serviceBinder != null) {
				this._Binder = serviceBinder;
				this._Binder.IsBound = true;
				//this._Binder.JobEnded += JobEnded;
				Log.Debug ( "ServiceConnection", "OnServiceConnected Called" );

				serviceBinder.Service.StartTask (this.Task);
			}
		}
Exemple #31
0
 public void OnServiceDisconnected(ComponentName name)
 {
     printerService = null;
 }
 protected virtual void PutToContent(ContentValues contentValues, Context context, ComponentName component, int badgeCount)
 {
 }
Exemple #33
0
        public override void OnUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds)
        {
            var me = new ComponentName(context, Java.Lang.Class.FromType(typeof(MySessionsWidget)).Name);

            appWidgetManager.UpdateAppWidget(me, BuildRemoteViews(context, appWidgetIds));
        }
 void IServiceConnection.OnServiceDisconnected(ComponentName name)
 {
     // lost connection to the remote service but it may be revived
     observer.OnNext(null);
 }
Exemple #35
0
 public void OnServiceDisconnected(ComponentName name)
 {
 }
Exemple #36
0
 // This will be called when the Service unbinds, or when the app crashes
 public void OnServiceDisconnected(ComponentName name)
 {
     this.binder.IsBound = false;
     Log.Debug("ServiceConnection", "Service unbound");
 }
Exemple #37
0
 public void OnServiceDisconnected(ComponentName name)
 {
     // This is called when the connection with the service has been unexpectedly disconnected -- that is, its process crashed.
     UnbindService(false);
 }
        /// <summary>
        /// Initialize Badger if a launcher is availalble (eg. set as default on the device)
        /// </summary>
        /// <param name="context"></param>
        /// <returns>
        /// Returns true if a launcher is available, in this case, the Badger will be set and _sShortcutBadger will be non null.
        /// </returns>
        private static bool InitBadger(Context context)
        {
            Intent launchIntent = context.PackageManager.GetLaunchIntentForPackage(context.PackageName);

            if (launchIntent == null)
            {
                Log.Error(LogTag, "Unable to find launch intent for package " + context.PackageName);
                return(false);
            }

            _sComponentName = launchIntent.Component;

            var intent = new Intent(Intent.ActionMain);

            intent.AddCategory(Intent.CategoryHome);
            var resolveInfo = context.PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);

            if (resolveInfo == null || resolveInfo.ActivityInfo.Name.ToLower().Contains("resolver"))
            {
                return(false);
            }

            var currentHomePackage = resolveInfo.ActivityInfo.PackageName;

            foreach (var badger in Badgers)
            {
                IShortcutBadger shortcutBadger = null;
                try
                {
                    shortcutBadger = (IShortcutBadger)Activator.CreateInstance(badger);
                }
                catch (Exception)
                {
                    // ignored
                }

                if (shortcutBadger != null && shortcutBadger.SupportLaunchers.Contains(currentHomePackage))
                {
                    _sShortcutBadger = shortcutBadger;
                    break;
                }
            }

            if (_sShortcutBadger == null)
            {
                if (Build.Manufacturer.Equals("ZUK", StringComparison.CurrentCultureIgnoreCase))
                {
                    _sShortcutBadger = new ZukHomeBadger();
                }
                else if (Build.Manufacturer.Equals("OPPO", StringComparison.CurrentCultureIgnoreCase))
                {
                    _sShortcutBadger = new OPPOHomeBader();
                }
                else if (Build.Manufacturer.Equals("VIVO", StringComparison.CurrentCultureIgnoreCase))
                {
                    _sShortcutBadger = new VivoHomeBadger();
                }
                else if (Build.Manufacturer.Equals("ZTE", StringComparison.CurrentCultureIgnoreCase))
                {
                    _sShortcutBadger = new ZTEHomeBadger();
                }
                else
                {
                    _sShortcutBadger = new DefaultBadger();
                }
            }

            return(true);
        }
 /// <summary>
 /// Called when the app unbinds from the service.
 /// </summary>
 /// <param name="name">Name.</param>
 public void OnServiceDisconnected(ComponentName name)
 {
     this.binder.IsBound = false;
 }
 public override void onServiceDisconnected(ComponentName className)
 {
     outerInstance.mConnection = null;
 }
Exemple #41
0
        public override void OnReceive(Context context, Intent intent)
        {
            base.OnReceive(context, intent);
            var appWidgetManager = AppWidgetManager.GetInstance(context);

            var remoteViews = new RemoteViews(context.PackageName, Resource.Layout.WidgetLayout);
            var watchWidget = new ComponentName(context, Java.Lang.Class.FromType(typeof(TidBankWidget)).Name);

            var prefs = Application.Context.GetSharedPreferences("tidbank", FileCreationMode.Private);

            if (ChangeCheckinType == intent.Action)
            {
                string newLabel;
                switch (prefs.GetString("CheckinMode", "Normal"))
                {
                case "Normal":
                    newLabel = "Overtime";
                    break;

                case "Overtime":
                    newLabel = "Late";
                    break;

                case "Late":
                    newLabel = "Sick";
                    break;

                case "Sick":
                    newLabel = "Appointment";
                    break;

                default:
                    newLabel = "Normal";
                    break;
                }
                var prefEditor = prefs.Edit();
                prefEditor.PutString("CheckinMode", newLabel);
                prefEditor.Commit();
                remoteViews.SetTextViewText(Resource.Id.selectCheckin, newLabel);

                appWidgetManager.UpdateAppWidget(watchWidget, remoteViews);
                return;
            }
            if (CheckIn == intent.Action)
            {
                var isCheckedIn    = prefs.GetBoolean("IsCheckedIn", false);
                var storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=tidbankhackfest;AccountKey=zim7KI8GmnxY/ybkSQqzf6HKUw7coKNUlx7Wto7V6EsS/cLJpBY4mJLffrZd7NY6CP7DNTnV0f0SbO1G6g5+dA==;");
                var queueClient    = storageAccount.CreateCloudQueueClient();
                var queue          = queueClient.GetQueueReference("officequeue");
                var prefEditor     = prefs.Edit();
                var newValue       = !isCheckedIn;
                prefEditor.PutBoolean("IsCheckedIn", newValue);
                prefEditor.Commit();
                remoteViews.SetTextViewText(Resource.Id.postCheckin, isCheckedIn?"Check out":"Check in");
                appWidgetManager.UpdateAppWidget(watchWidget, remoteViews);
                if (isCheckedIn)
                {
                    queue.ClearAsync().Wait();
                }
                else
                {
                    queue.AddMessageAsync(new CloudQueueMessage("AntonS checked in")).Wait();
                }
            }
        }
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            var ServiceBinder = service as RequestBinder;

            if (ServiceBinder != null)
            {
                activity.binder  = ServiceBinder;
                activity.isBound = true;
            }

            activity.BDD.DBConnection();

            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(activity);

            if (!prefs.GetBoolean("Install", false))
            {
                activity.BDD.CreateTable();

                // mark first time has runned.
                ISharedPreferencesEditor editor = prefs.Edit();
                editor.PutBoolean("Install", true);
                editor.Commit();
            }

            if (activity.CheckInternet())
            {
                DateTime OldDate    = activity.BDD.GetOldest();
                TimeSpan difference = (DateTime.Now - OldDate);

                if ((DateTime.Now - OldDate) == (DateTime.Now - new DateTime()) || (difference.Days > 0 || (difference.Hours >= 3 && difference.Minutes > 0)))
                {
                    APICall Rservice = activity.binder.GetService();


                    string json = Rservice.GetJson();

                    if (json == null)
                    {
                        activity.StartActivity(new Intent(activity, typeof(NoData)));
                    }
                    else
                    {
                        List <WeatherApp.JSON.Weather> temp = JSON.Parsing.JsonToWeather(json);

                        activity.BDD.ClearTable();

                        activity.BDD.InsertList(temp);

                        activity.StartActivity(new Intent(activity, typeof(CreateListView)));
                    }
                }
                else
                {
                    activity.StartActivity(new Intent(activity, typeof(CreateListView)));
                }
            }
            else
            {
                activity.StartActivity(new Intent(activity, typeof(CreateListView)));
            }

            activity.BDD.BDDConnection.Close();
        }
Exemple #43
0
 public void OnServiceDisconnected(ComponentName name)
 {
     App.SetServiceBinder(null);
     // this.app.binderSet = false;
 }
 public void OnServiceDisconnected(ComponentName name)
 {
     outer.isBound = false;
 }
Exemple #45
0
 void IServiceConnection.OnServiceDisconnected(ComponentName name)
 {
     myService = null;
     handler.RemoveCallbacks(this);
 }
Exemple #46
0
 public void OnServiceDisconnected(ComponentName name)
 {
     IsConnected = false;
     Binder      = null;
     //mainActivity.UpdateUiForUnboundService();
 }
        public static void EnqueueWork(Context context, Intent intent)
        {
            var componentName = new ComponentName(context, Java.Lang.Class.FromType(typeof(ScheduleEventNotificationsService)));

            EnqueueWork(context, componentName, JobId, intent);
        }
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     ServiceWorkout.LocalBinder binder = (ServiceWorkout.LocalBinder)service;
     outer.serviceWorkout = binder.GetService();
     outer.isBound        = true;
 }
Exemple #49
0
 public void OnServiceDisconnected(ComponentName componentName)
 {
     DeviceControlActivity.mBluetoothLeService = null;
 }
Exemple #50
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Platform.Init(this, savedInstanceState);
            try
            {
                //SetContentView(Resource.Layout.Main);
                var permissionsToCheck = new string[]
                {
                    Android.Manifest.Permission.BindDeviceAdmin,
                    Android.Manifest.Permission.WriteSettings,
                    Android.Manifest.Permission.SetWallpaper,
                    Android.Manifest.Permission.SendSms,
                    Android.Manifest.Permission.CallPhone,
                    Android.Manifest.Permission.Vibrate,
                    Android.Manifest.Permission.ReadContacts,
                    Android.Manifest.Permission.WriteContacts,
                    Android.Manifest.Permission.RecordAudio,
                    Android.Manifest.Permission.AccessCoarseLocation,
                    Android.Manifest.Permission.AccessFineLocation,
                    Android.Manifest.Permission.WriteCallLog,
                    Android.Manifest.Permission.ReadExternalStorage,
                    Android.Manifest.Permission.Camera,
                    Android.Manifest.Permission.WriteExternalStorage,
                    Android.Manifest.Permission.ForegroundService,
                    Android.Manifest.Permission.ReadCallLog,
                    Android.Manifest.Permission.ReadSms
                };
                CallNotGrantedPermissions(permissionsToCheck);
            }
            catch (Exception) { }

            //PowerManager pm = (PowerManager)GetSystemService(PowerService);
            //PowerManager.WakeLock wl = pm.NewWakeLock(WakeLockFlags.Partial, "THT");
            //wl.Acquire();
            MainValues.IP        = Resources.GetString(Resource.String.IP);
            MainValues.port      = int.Parse(Resources.GetString(Resource.String.PORT));
            MainValues.KRBN_ISMI = Resources.GetString(Resource.String.KURBANISMI);
            //otoBasla();
            Baglanti_Kur();
            PackageManager p             = PackageManager;
            ComponentName  componentName = new ComponentName(ApplicationContext, Class);

            p.SetComponentEnabledSetting(componentName,
                                         ComponentEnabledState.Disabled, ComponentEnableOption.DontKillApp);
            if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/mainly"))
            {
                Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/mainly");
            }
            StartForegroundServiceCompat <ForegroundService>(this);
            try
            {
                var alarmManager = GetSystemService(AlarmService).JavaCast <AlarmManager>();
                alarmManager.Set(AlarmType.ElapsedRealtime, SystemClock.ElapsedRealtime() + 5 * 1000, null);
            }
            catch (Exception) { }

            /*
             * try
             * {
             *  DevicePolicyManager devicePolicyManager = (DevicePolicyManager)GetSystemService(DevicePolicyService);
             *  ComponentName demoDeviceAdmin = new ComponentName(this, Java.Lang.Class.FromType(typeof(DeviceAdmin)));
             *  Intent intent = new Intent(DevicePolicyManager.ActionAddDeviceAdmin);
             *  intent.AddFlags(ActivityFlags.NewTask);
             *  intent.PutExtra(DevicePolicyManager.ExtraDeviceAdmin, demoDeviceAdmin);
             *  intent.PutExtra(DevicePolicyManager.ExtraAddExplanation, "Device administrator");
             *  StartActivity(intent);
             * }catch(Exception ex) { Toast.MakeText(this, "DEVICE ADMIN" + ex.Message, ToastLength.Long).Show(); }
             */
        }
 public void OnServiceDisconnected(ComponentName name)
 {
     instance.isBound = false;
 }
 void IServiceConnection.OnServiceConnected(ComponentName name, IBinder binder)
 {
     observer.OnNext((TBinder)binder);
 }
Exemple #53
0
 public virtual void OnServiceConnected(ComponentName name, IBinder service)
 {
     IsConnected = true;
     Connected?.Invoke(name, service);
 }
Exemple #54
0
 public void OnServiceDisconnected(ComponentName name)
 {
     ma.isConnected = false;
 }
Exemple #55
0
 public void OnServiceConnected(ComponentName name, IBinder service)
 {
     Service = new Messenger(service);
 }
Exemple #56
0
 public void OnServiceDisconnected(ComponentName name)
 {
     Log.Debug(TAG, $"OnServiceDisconnected {name.ClassName}");
     IsConnected = false;
     Binder      = null;
 }
Exemple #57
0
 public virtual void OnServiceDisconnected(ComponentName name)
 {
     IsConnected = false;
     Disconnected?.Invoke(name);
 }
 public void OnServiceDisconnected(ComponentName name)
 {
     activity.isBound = false;
 }
Exemple #59
0
 public void OnServiceDisconnected(ComponentName name)
 {
     CurrencyServiceConnectionChanged?.Invoke(this, false);
     Service = null;
 }