public PayPalManager (Context context, PayPal.Forms.Abstractions.PayPalConfiguration xfconfig) { Context = context; switch (xfconfig.Environment) { case PayPal.Forms.Abstractions.Enum.Environment.NoNetwork: CONFIG_ENVIRONMENT = PayPalConfiguration.EnvironmentNoNetwork; break; case PayPal.Forms.Abstractions.Enum.Environment.Production: CONFIG_ENVIRONMENT = PayPalConfiguration.EnvironmentProduction; break; case PayPal.Forms.Abstractions.Enum.Environment.Sandbox: CONFIG_ENVIRONMENT = PayPalConfiguration.EnvironmentSandbox; break; } CONFIG_CLIENT_ID = xfconfig.PayPalKey; config = new PayPalConfiguration () .Environment (CONFIG_ENVIRONMENT) .ClientId (CONFIG_CLIENT_ID) .AcceptCreditCards (xfconfig.AcceptCreditCards) // The following are only used in PayPalFuturePaymentActivity. .MerchantName (xfconfig.MerchantName) .MerchantPrivacyPolicyUri (global::Android.Net.Uri.Parse (xfconfig.MerchantPrivacyPolicyUri)) .MerchantUserAgreementUri (global::Android.Net.Uri.Parse (xfconfig.MerchantUserAgreementUri)); Intent intent = new Intent (Context, typeof(PayPalService)); intent.PutExtra (PayPalService.ExtraPaypalConfiguration, config); Context.StartService (intent); }
public override void OnReceive (Context context, Intent intent) { if (WiFiHelper.IsWiFiAvailable()) { //connected to wifi let's do sync Intent DbServiceIntent = new Intent ("com.ETCTimeApp.DbSyncService"); new Thread (() => context.StartService (DbServiceIntent)).Start (); } }
public override void OnReceive(Context context, Intent intent) { if (intent.Action != AudioManager.ActionAudioBecomingNoisy) return; //signal the service to stop! var stopIntent = new Intent(StreamingBackgroundService.ActionStop); context.StartService(stopIntent); }
public override void OnReceive(Context context, Intent intent) { if (intent.Action == Intent.ActionBootCompleted) { Intent serviceIntent = new Intent(context, typeof(AndroidSensusService)); serviceIntent.PutExtra(AndroidSensusServiceHelper.MAIN_ACTIVITY_WILL_BE_SET, false); context.StartService(serviceIntent); } }
private void StartService(Context context) { try { Intent serviceStartIntent = new Intent (context, typeof(com.tarabel.bluetoothnotify.BluetoothLowEnergySearchService)); serviceStartIntent.AddFlags (ActivityFlags.NewTask); context.StartService (serviceStartIntent); } catch (Exception ex) { Log.Info ("com.tarabel.bluetoothnotify", "error while starting service " + ex.ToString()); } }
public override void OnReceive (Context context, Intent intent) { Log.Debug ("PhoneBootedBroadcastReceiver", "ActionBootCompleted received"); var activeAlarms = new DBManager ().GetAll ().Where (alarm => alarm.Enabled).ToList (); if (activeAlarms != null && activeAlarms.Count > 0) { context.StartService (new Intent (context, typeof(RestoreAfterRebootService))); } }
/// <summary> /// Register's the Device for C2DM Messages /// </summary> /// <param name="context">Context</param> /// <param name="senderIdEmail">Email address whitelisted as the Sender ID for your App</param> public static void Register(Context context, string senderIdEmail) { //Create our intent, with a pending intent to our app's broadcast Intent registrationIntent = new Intent(GOOGLE_ACTION_C2DM_INTENT_REGISTER); registrationIntent.PutExtra("app", PendingIntent.GetBroadcast(context, 0, new Intent(), 0)); registrationIntent.PutExtra("sender", senderIdEmail); //Start intent context.StartService(registrationIntent); }
public override void OnReceive(Context context, Intent intent) { Toast.MakeText(context,"Repeating alarm received.", ToastLength.Short).Show(); WakeReminderIntentService.acquireStaticLock(context); Intent i = new Intent(context, typeof(ReminderService)); context.StartService(i); }
public override void OnReceive(Context context, Intent intent) { if (intent.Action != AudioManager.ActionAudioBecomingNoisy) return; //signal the service to pause! var pauseIntent = new Intent(MediaServiceBase.ActionPause); pauseIntent.SetPackage(context.PackageName); context.StartService(pauseIntent); }
public override void OnReceive (Context context, Intent intent) { if (intent.Action != AudioManager.ActionAudioBecomingNoisy) { return; } //signal the service to stop! var stopIntent = new Intent (PlayerService.ACTION_STOP); context.StartService (stopIntent); }
public override void OnUpdate (Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // Request widget update. var serviceIntent = new Intent (context, typeof (InitWidgetService)); context.StartService (serviceIntent); // Setup widget UI. SetupWidget (context); base.OnUpdate (context, appWidgetManager, appWidgetIds); }
// private BackgroundService bs; // private Context cont; /// <summary> /// Invoked by OS when device is rebooted Permisssion is being given /// in manifest . When device rebooted OS broadcast it to all /// applications and receiver with this permisssion willbe invoked /// </summary> /// <param name="context"></param> /// <param name="intent"></param> public override void OnReceive(Context context, Intent intent) { try { Toast.MakeText(context, "Broadcast Receive: ", ToastLength.Long).Show(); context.StartService(new Intent(context, typeof(BackgroundService))); } catch (Exception ex) { } }
public PayPalManager (Context context) { Context = context; config = new PayPalConfiguration () .Environment (CONFIG_ENVIRONMENT) .ClientId (CONFIG_CLIENT_ID) // The following are only used in PayPalFuturePaymentActivity. .MerchantName ("Example Merchant") .MerchantPrivacyPolicyUri (Android.Net.Uri.Parse ("https://www.example.com/privacy")) .MerchantUserAgreementUri (Android.Net.Uri.Parse ("https://www.example.com/legal")); Intent intent = new Intent (Context, typeof(PayPalService)); intent.PutExtra (PayPalService.ExtraPaypalConfiguration, config); Context.StartService (intent); }
static void RunIntentInService(Context context, Intent intent) { lock (LOCK) { if (wakeLock == null) { var pm = PowerManager.FromContext(context); wakeLock = pm.NewWakeLock(WakeLockFlags.Partial, "Woken lock"); } } wakeLock.Acquire(); intent.SetClass(context, typeof(GPSDroidService)); context.StartService(intent); }
/// <summary> /// Receive On device Reboot /// </summary> /// <param name="context"></param> /// <param name="intent"></param> public override void OnReceive(Context context, Intent intent) { try { //Toast.MakeText(context, "Sms Service Started" + intent.Action, ToastLength.Short).Show(); Intent ReceiverIntent = new Intent(context, typeof(BackgroundService)); ReceiverIntent.SetAction("ReceiverIntent"); context.StartService(ReceiverIntent); } catch (Exception ex) { Toast.MakeText(context, "Exception on starting service" + ex.Message, ToastLength.Short).Show(); //Android.Util.Log.Info("Service", ex.Message + "\n" + ex.InnerException); } }
public static void RunIntentInService(Context context, Intent intent) { lock (LOCK) { if (sWakeLock == null) { // This is called from BroadcastReceiver, there is no init. var pm = Android.OS.PowerManager.FromContext(context); sWakeLock = pm.NewWakeLock(Android.OS.WakeLockFlags.Partial, "My WakeLock Tag"); } } sWakeLock.Acquire(); intent.SetClass(context, typeof(PNIntentService)); context.StartService(intent); }
internal static void RunIntentInService(Context context, Intent intent) { lock (_lock) { if (_wakeLock == null) { // This is called from BroadcastReceiver, there is no init. var pm = PowerManager.FromContext(context); _wakeLock = pm.NewWakeLock( WakeLockFlags.Partial, "Donky GCM Wakelock"); } } _wakeLock.Acquire(); intent.SetClass(context, typeof(DonkyGcmIntentService)); context.StartService(intent); }
public static void RunIntentInService(Context context, Intent intent) { lock (Lock) { if (_wakeLock == null) { // This is called from BroadcastReceiver, there is no init. var pm = PowerManager.FromContext(context); _wakeLock = pm.NewWakeLock( WakeLockFlags.Partial, "My WakeLock Tag"); } } _wakeLock.Acquire(); intent.SetClass(context, typeof(RemoteNotificationService)); context.StartService(intent); }
public override void OnReceive(Context context, Intent intent) { Log.Info(Tag, "LocaltionReceiver booting-------------------------"); Intent _intent = new Intent(context, typeof(LocationService)); if (Intent.ActionBootCompleted.Equals(intent.Action)) { Log.Debug(Tag, "Boot Completed"); _intent.PutExtra("startingModel", 1); } else { _intent.PutExtra("startingModel", 2); } context.StartService(_intent); }
public bool StartService() { var myserviceintent = new Android.Content.Intent(context, Java.Lang.Class.FromType(typeof(MyService))); Android.Content.ComponentName componentName; if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.O) { componentName = context.StartForegroundService(myserviceintent); } else { componentName = context.StartService(myserviceintent); } SetServiceActive(context, componentName != null); return(componentName != null); }
internal static void RunIntentInService(Context context, Intent intent, Type classType) { lock (LOCK) { if (sWakeLock == null) { // This is called from BroadcastReceiver, there is no init. var pm = PowerManager.FromContext(context); sWakeLock = pm.NewWakeLock(WakeLockFlags.Partial, WAKELOCK_KEY); } } Log.Verbose(TAG, "Acquiring wakelock"); sWakeLock.Acquire(); //intent.SetClassName(context, className); intent.SetClass(context, classType); context.StartService(intent); }
/// <Docs>The Context in which the receiver is running.</Docs> /// <summary> /// When we receive the action media button intent /// parse the key event and tell our service what to do. /// </summary> /// <param name="context">Context.</param> /// <param name="intent">Intent.</param> public override void OnReceive (Context context, Intent intent) { if (intent.Action != Intent.ActionMediaButton) return; //The event will fire twice, up and down. // we only want to handle the down event though. var key = (KeyEvent) intent.GetParcelableExtra(Intent.ExtraKeyEvent); if (key.Action != KeyEventActions.Down) return; var action = MediaPlayerService.ActionPlay; switch (key.KeyCode) { case Keycode.Headsethook: case Keycode.MediaPlayPause: action = MediaPlayerService.ActionTogglePlayback; break; case Keycode.MediaPlay: action = MediaPlayerService.ActionPlay; break; case Keycode.MediaPause: action = MediaPlayerService.ActionPause; break; case Keycode.MediaStop: action = MediaPlayerService.ActionStop; break; case Keycode.MediaNext: action = MediaPlayerService.ActionNext; break; case Keycode.MediaPrevious: action = MediaPlayerService.ActionPrevious; break; default: return; } var remoteIntent = new Intent(action); context.StartService(remoteIntent); }
/// <summary> /// Do a <see cref="Context.StartService(Intent)"/>, but holding a wake lock while the service starts. /// </summary> /// <remarks> /// This will modify the intent to hold an extra identifying the wake lock. When the service receives it /// in <see cref="Service.OnStartCommand"/>, it should pass back the <see cref="Intent"/> it receives there to /// <see cref="CompleteWakefulIntent(Intent)"/> in order to release the wake lock. /// </remarks> /// <param name="context">The <see cref="Context"/> in which it operate.</param> /// <param name="intent">The <see cref="Intent"/> with which to start the service, as per <see cref="Context.StartService(Intent)"/>.</param> /// <returns>The <see cref="ComponentName"/> of the <see cref="Service"/> being started.</returns> internal static ComponentName StartWakefulService(Context context, Intent intent) { lock (activeWakeLocksMutex) { int id = nextId; nextId++; if (nextId <= 0) { nextId = 1; } intent.PutExtra(ExtraWakeLockId, id); ComponentName comp = context.StartService(intent); if (comp == null) { return null; } PowerManager pm = PowerManager.FromContext(context); PowerManager.WakeLock wl = pm.NewWakeLock(WakeLockFlags.Partial, "wake: " + comp.FlattenToShortString()); wl.SetReferenceCounted(false); wl.Acquire(WakeLockTimeout); activeWakeLocks[id] = wl; return comp; } }
public override void OnReceive(Context context, Intent intent) { Intent receiveIntent = new Intent(context, typeof(NotifierService)); context.StartService(receiveIntent); }
public override void OnReceive ( Context context, Intent intent ) { context.StartService (new Intent (context, typeof (LocationService))); }
public override void OnUpdate (Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { // To prevent any ANR timeouts, we perform the update in a service context.StartService (new Intent (context, typeof (UpdateService))); }
public static void Register (Context context) { context.StartService (new Intent (context, typeof(MyRegistrationService))); }
public static void requestPurchase(Context context, string itemId, string developerPayload) { Intent intent = createIntent(context, Action.REQUEST_PURCHASE); intent.PutExtra(EXTRA_ITEM_ID, itemId); intent.PutExtra(EXTRA_DEVELOPER_PAYLOAD, developerPayload); context.StartService(intent); }
public static void getPurchaseInformation(Context context, string[] notifyIds, long nonce) { Intent intent = createIntent(context, Action.GET_PURCHASE_INFORMATION); intent.PutExtra(EXTRA_NOTIFY_IDS, notifyIds); intent.PutExtra(EXTRA_NONCE, nonce); context.StartService(intent); }
public static void checkBillingSupported(Context context) { Intent intent = createIntent(context, Action.CHECK_BILLING_SUPPORTED); context.StartService(intent); }
public static void restoreTransations(Context context, long nonce) { Intent intent = createIntent(context, Action.RESTORE_TRANSACTIONS); intent.SetClass(context, typeof(BillingService)); intent.PutExtra(EXTRA_NONCE, nonce); context.StartService(intent); }