Exemple #1
0
        private void ButtonSaveSettings_Click(object sender, EventArgs e)
        {
            updatePendingIntent.Send();
            settings.Write();

            Toast.MakeText(Application.Context, SaveSettings, ToastLength.Short).Show();
        }
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action == Intent.ActionScreenOn)
            {
                //Nice easter eggs here, lol.
                IsScreenOn = true;
            }
            else if (intent.Action == Intent.ActionScreenOff)
            {
                //Start hidden in Darkness. :$
                IsScreenOn = false;
                int delaytolockscreen = int.Parse(configurationManager.RetrieveAValue(ConfigurationParameters.StartLockscreenDelayTime, "0"));

                ThreadPool.QueueUserWorkItem(m =>
                {
                    Thread.Sleep(delaytolockscreen); //Seconds of delay before locking screen(Start the LockScreen Activity)
                                                     //The reason to check if the Screen is turned off is because User can Turn off device screen,
                                                     //then turn it on before the delay to lock screen is finished.
                                                     //So, the Activity will start even if the screen is On, so,
                                                     //in summary the Lockscreen only can start when screen is off
                    using (Intent lockScreenIntent = new Intent(Application.Context, typeof(LockScreenActivity)))
                    {
                        lockScreenIntent.AddFlags(ActivityFlags.NewDocument);

                        if (IsScreenOn == false)
                        {
                            PendingIntent pendingIntent = PendingIntent.GetActivity(Application.Context, 0, lockScreenIntent, 0);

                            pendingIntent.Send();
                        }
                    }
                });
            }
        }
        public void Pause()
        {
            intent.SetAction(Thread_radio.ActionPause);
            PendingIntent pendingIntent = PendingIntent.GetService(Application.Context, 1, intent, PendingIntentFlags.UpdateCurrent);

            pendingIntent.Send();
            //Notification_player.Updater_Notification();
        }
Exemple #4
0
        public void StopAlarm()
        {
            Intent intent = new Intent(Android.App.Application.Context, typeof(StartAlarmService));

            intent.PutExtra("alarm", false);
            PendingIntent pendingIntent = PendingIntent.GetService(Android.App.Application.Context, 0, intent, PendingIntentFlags.UpdateCurrent);

            pendingIntent.Send();
        }
Exemple #5
0
 public override void OnReceive(Context context, Intent intent)
 {
     if (sharedPreferences.GetBoolean(ConfigurationParameters.LockOnBoot, false) == true)
     {
         Intent lanzarLockScreen = new Intent(context, typeof(LockScreenActivity));
         lanzarLockScreen.AddFlags(ActivityFlags.NewTask);
         PendingIntent pendingIntent = PendingIntent.GetActivity(context, 0, lanzarLockScreen, 0);
         pendingIntent.Send();
     }
 }
 public override void OnReceive(Context context, Intent intent)
 {
     if (configurationManager.RetrieveAValue(ConfigurationParameters.LockOnBoot))
     {
         Intent lanzarLockScreen = new Intent(context, typeof(LockScreenActivity));
         lanzarLockScreen.AddFlags(ActivityFlags.NewTask);
         PendingIntent pendingIntent = PendingIntent.GetActivity(context, 0, lanzarLockScreen, 0);
         pendingIntent.Send();
     }
 }
            public void OnSendFinished(PendingIntent pendingIntent, Intent intent, [GeneratedEnum] Result resultCode, string resultData, Bundle resultExtras)
            {
                var packageManager = _context.PackageManager;

                if (intent.ResolveActivity(packageManager) == null)
                {
                    _fallbackIntent.Send();
                }

                _handlerThread.QuitSafely();
            }
        private void MusicPlayerContainer_Click(object sender, EventArgs e)
        {
            if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
            {
                if (KeyguardHelper.IsDeviceCurrentlyLocked())
                {
                    KeyguardHelper.RequestDismissKeyguard(Activity);
                }
            }

            try { activityIntent.Send(); }
            catch { Log.Info("LiveDisplay", "Failed to send the Music pending intent"); }
        }
        private void OnWeatherDataUpdate(int[] widgetsIds, PendingIntent pendingIntent)
        {
            if (widgetsIds == null || widgetsIds.Length == 0)
            {
                return;
            }

            try
            {
                var api = new ServiceApi();
                api.UpdateWeatherData(this, widgetsIds, CancellationToken.None);
                api.AppWidgetUpdate(this, widgetsIds);
            }
            finally
            {
                pendingIntent?.Send(this, Result.Ok, null);
            }
        }
 internal virtual void startBuyPageActivity(PendingIntent pendingIntent, Intent intent)
 {
     if (mStartIntentSender != null)
     {
         // This is on Android 2.0 and beyond.  The in-app buy page activity
         // must be on the activity stack of the application.
         try
         {
             // This implements the method call:
             // mActivity.startIntentSender(pendingIntent.getIntentSender(),
             //     intent, 0, 0, 0);
             mStartIntentSenderArgs[0] = pendingIntent.IntentSender;
             mStartIntentSenderArgs[1] = intent;
             mStartIntentSenderArgs[2] = Convert.ToInt32(0);
             mStartIntentSenderArgs[3] = Convert.ToInt32(0);
             mStartIntentSenderArgs[4] = Convert.ToInt32(0);
             mStartIntentSender.Invoke(mActivity, mStartIntentSenderArgs);
         }
         catch (Exception e)
         {
             Log.Error(TAG, "error starting activity", e);
         }
     }
     else
     {
         // This is on Android version 1.6. The in-app buy page activity must be on its
         // own separate activity stack instead of on the activity stack of
         // the application.
         try
         {
             pendingIntent.Send(mActivity, 0, intent); // code
         }
         catch (PendingIntent.CanceledException e)
         {
             Log.Error(TAG, "error starting activity", e);
         }
     }
 }
Exemple #11
0
 /**
  * Starts the specified purchase intent with the specified activity.
  *
  * @param activity
  * @param purchaseIntent
  *            purchase intent.
  * @param intent
  */
 public static void startPurchaseIntent(Activity activity, PendingIntent purchaseIntent, Intent intent)
 {
     if (Compatibility.isStartIntentSenderSupported())
     {
         // This is on Android 2.0 and beyond. The in-app buy page activity
         // must be on the activity stack of the application.
         Compatibility.startIntentSender(activity, purchaseIntent.IntentSender, intent);
     }
     else
     {
         // This is on Android version 1.6. The in-app buy page activity must
         // be on its own separate activity stack instead of on the activity
         // stack of the application.
         try
         {
             purchaseIntent.Send(activity, 0 /* code */, intent);
         }
         catch (Android.App.PendingIntent.CanceledException e)
         {
             Log.Error(LOG_TAG, "Error starting purchase intent", e);
         }
     }
 }
 private void MusicPlayerContainer_Click(object sender, EventArgs e)
 {
     try { activityIntent.Send(); }
     catch { Log.Info("LiveDisplay", "Failed to send the Music pending intent"); }
 }
Exemple #13
0
 private void OnNotificationClicked(object sender, System.EventArgs e)
 {
     notificationAction.Send();
     v.Visibility = ViewStates.Invisible;
 }
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action == Intent.ActionScreenOn)
            {
                //Nice easter eggs here, lol.
                IsScreenOn = true;
            }
            else if (intent.Action == Intent.ActionScreenOff)
            {
                //try
                //{
                //    //Java.Lang.Runtime.GetRuntime().Exec("settings put global heads_up_notifications_enabled 0");
                //    string command = "settings put global heads_up_notifications_enabled 0";
                //    Java.Lang.Process p = Java.Lang.Runtime.GetRuntime().Exec(command);
                //    var errorStream = p.ErrorStream;
                //    InputStreamReader inputStreamReader = new InputStreamReader(errorStream);
                //    BufferedReader bf = new BufferedReader(inputStreamReader);
                //    string line;
                //    while((line = bf.ReadLine())!= null)
                //    {
                //        Log.Debug("LiveDisplay", line);
                //    }
                //    //p.WaitFor();
                //}
                //catch (System.Exception)
                //{
                //    throw;
                //}
                //Start hidden in Darkness. :$
                IsScreenOn = false;

                if (AwakeService.isLaidDown == false)
                {
                    ScreenTurnedOffWhileInVertical = true;
                }
                else
                {
                    ScreenTurnedOffWhileInVertical = false;
                }

                int delaytolockscreen = int.Parse(configurationManager.RetrieveAValue(ConfigurationParameters.StartLockscreenDelayTime, "0"));

                ThreadPool.QueueUserWorkItem(m =>
                {
                    Thread.Sleep(delaytolockscreen); //Seconds of delay before locking screen(Start the LockScreen Activity)
                                                     //The reason to check if the Screen is turned off is because User can Turn off device screen,
                                                     //then turn it on before the delay to lock screen is finished.
                                                     //So, the Activity will start even if the screen is On, so,
                                                     //in summary the Lockscreen only can start when screen is off
                    using (Intent lockScreenIntent = new Intent(Application.Context, typeof(LockScreenActivity)))
                    {
                        lockScreenIntent.AddFlags(ActivityFlags.NewDocument | ActivityFlags.NoAnimation);

                        if (IsScreenOn == false)
                        {
                            PendingIntent pendingIntent = PendingIntent.GetActivity(Application.Context, 0, lockScreenIntent, 0);

                            pendingIntent.Send();
                        }
                    }
                });
            }
        }