示例#1
0
        public static async Task <bool> PostIssue <T>(object obj, Android.Content.Context acc) where T : Model.Issue
        {
            if (UserInfoHolder.Status == "blocked")
            {
                Toast.MakeText(acc, "You have been blocked from problem update and cannot post any issue", ToastLength.Long).Show();
                Intent i = new Intent(acc, typeof(FragmentHomeActivity));
                acc.StartActivity(i);
                return(false);
            }
            var issueObj = (T)obj;

            issueObj.isresolved = 0;

            HttpClient client   = new HttpClient();
            var        uri      = baseuri + "/api/issue/postnewissue";
            var        json     = JsonConvert.SerializeObject(obj);
            var        content  = new StringContent(json, Encoding.UTF8, "application/json");
            var        response = await client.PostAsync(uri, content);

            if (response.StatusCode == System.Net.HttpStatusCode.Accepted)
            {
                Intent i = new Intent(acc, typeof(FragmentHomeActivity));


                DataOper.SendNotification(new Model.Notification()
                {
                    notification_title = "Issue Alert", notification_text = issueObj.issueStatement, notification_image = issueObj.IssueImage
                });
                acc.StartActivity(i);

                return(true);
            }
            return(false);
        }
示例#2
0
        public void onCallStateChanged(string state, string incomingNumber, Context _context)
        {
            // TODO React to incoming call. // React to incoming call. string number=incomingNumber;
            //screen =_Context.FindViewById<ViewGroup>(Resource.Id.IncomingCall);
            // If phone ringing
            if(state == TelephonyManager.ExtraStateRinging )
            {

                /*var i = new Intent(_context, typeof (PlayerSevise));
                i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.PlayCommand);
                _context.StartService (i);*/

                var i = new Intent(_context, typeof (CallActivity));
                i.SetFlags (ActivityFlags.NewTask);
                _context.StartActivity (i);

                //Toast.MakeText(this, " Phone Is Riging ", ToastLength.Long).Show()
                //Toast.MakeText(_context,"phone is neither ringing nor in a call", ToastLength.Long).Show();

                }
            if (state == TelephonyManager.ExtraStateIdle) {
                /*var i = new Intent(_context, typeof (PlayerSevise));
                i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.StopCommand);
                _context.StartService (i);*/
            }

            if (state == TelephonyManager.ExtraStateOffhook) {
                /*var i = new Intent(_context, typeof (PlayerSevise));
                i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.StopCommand);
                _context.StartService (i);*/
            }
        }
示例#3
0
        private void RestoreApp()
        {
            var intent = new Intent(_context, typeof(KioskModeActivity));

            intent.AddFlags(ActivityFlags.NewTask);
            _context.StartActivity(intent);
        }
 public SocialAuthController(AccountOAuth.OAuthTypes providerType, Context c)
 {
     this.ProviderType = providerType;
     int type = 0;
     switch (providerType)
     {
         case AccountOAuth.OAuthTypes.FaceBook:
             type = 1;
             break;
         case AccountOAuth.OAuthTypes.Twitter:
             type = 2;
             break;
         case AccountOAuth.OAuthTypes.LinkedIn:
             type = 3;
             break;
         case AccountOAuth.OAuthTypes.Google:
             type = 4;
             break;
         case AccountOAuth.OAuthTypes.YouTube:
             type = 5;
             break;
     }
     Intent i = new Intent(c, typeof(WebViewer));
     i.PutExtra("type", type);
     c.StartActivity(i);
 }
        public static void SignInComplete(AuthenticationResult aresult, Context context)
        {
            App.AuthenticationContext = authContext;

            context.StartActivity(typeof(IncidentActivity));
            ((Activity)context).Finish();
        }
示例#6
0
 public static void OpenGallery(Context context)
 {
     Intent intent = new Intent(Intent.ActionView);
     intent.SetType("image/*");
     intent.SetFlags(ActivityFlags.NewTask);
     context.StartActivity(intent);
 }
		private const long WIDGET_REFRESH_DELAY_MS = 5000; //5 Seconds


			public override void OnReceive(Context context, Intent intent) {

			// Refresh the widget after a push comes in
			if (PushManager.ActionPushReceived == intent.Action) {
				RichPushWidgetUtils.RefreshWidget(context, WIDGET_REFRESH_DELAY_MS);
			}

			// Only takes action when a notification is opened
			if (PushManager.ActionNotificationOpened != intent.Action) {
				return;
			}

			// Ignore any non rich push notifications
			if (!RichPushManager.IsRichPushMessage(intent.Extras)) {
				return;
			}

			string messageId = intent.GetStringExtra(EXTRA_MESSAGE_ID_KEY);
			Logger.Debug("Notified of a notification opened with id " + messageId);

			Intent messageIntent = null;

			// Set the activity to receive the intent
			if ("home" == intent.GetStringExtra(ACTIVITY_NAME_KEY)) {
				messageIntent = new Intent(context, typeof (MainActivity));
			} else {
				// default to the Inbox
				messageIntent =  new Intent(context, typeof (InboxActivity));
			}

			messageIntent.PutExtra(RichPushApplication.MESSAGE_ID_RECEIVED_KEY, messageId);
			messageIntent.AddFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop | ActivityFlags.NewTask);
			context.StartActivity(messageIntent);
		}
 void OpenUrl(Context context)
 {
     Intent intent = new Intent(context, typeof(HtmlActivity));
     intent.PutExtra("URL", this.Url.ToString());
     intent.AddFlags(ActivityFlags.NewTask);
     context.StartActivity(intent);
 }
        static public async Task <int> forgotton_password_functionality(string email, Android.Content.Context acc)
        {
            if (Android.Util.Patterns.EmailAddress.Matcher(email).Matches() == true)
            {
                if (!await Account.EmailValidation(email))
                {
                    int codets = verifyEmail(email, acc);


                    var i = new Intent(acc, typeof(OTPVerify));
                    i.PutExtra("codetotest", JsonConvert.SerializeObject(codets));
                    i.PutExtra("email", JsonConvert.SerializeObject(email));
                    acc.StartActivity(i);
                    return(codets);
                }
                else
                {
                    Toast.MakeText(acc, "We didn't find any account with this email", ToastLength.Long).Show();
                    return(0);
                }
            }
            else
            {
                Toast.MakeText(acc, "Please enter correct email address!", ToastLength.Long).Show();
                return(0);
            }
        }
		private async Task<Auth0User> SendLoginAsync(
			Context context, 
			string connection, 
			bool withRefreshToken,
			string scope)
		{
			// Launch server side OAuth flow using the GET endpoint
			scope = IncreaseScopeWithOfflineAccess(withRefreshToken, scope);

			var tcs = new TaskCompletionSource<Auth0User> ();
			var auth = await this.GetAuthenticator (connection, scope);

			auth.Error += (o, e) =>
			{
				var ex = e.Exception ?? new AuthException (e.Message);
				tcs.TrySetException (ex);
			};

			auth.Completed += (o, e) =>
			{
				if (!e.IsAuthenticated) 
				{
					tcs.TrySetCanceled();
					return;
				}

				this.SetupCurrentUser (e.Account.Properties);
				tcs.TrySetResult (this.CurrentUser);
			};

			Intent intent = auth.GetUI (context);
			context.StartActivity (intent);

			return await tcs.Task;
		}
示例#11
0
        public override void OnReceive(Context context, Intent intent)
        {
            // Log.Info(Tag, "Intent received: " + intent.Action);
            // read the SendBroadcast data
            if (intent.Action == "com.alr.text")
            {
                string text = intent.GetStringExtra("MyData") ?? "Data not available";
                Toast.MakeText(context, text, ToastLength.Short).Show();
                Intent intents = new Intent(context, typeof(MainActivity));
                intents.AddFlags(ActivityFlags.NewTask);
                context.StartActivity(intents);
            }
            //read incomming sms
            if (intent.Action == IntentAction)
            {

                SmsMessage[] messages = Telephony.Sms.Intents.GetMessagesFromIntent(intent);

                var sb = new StringBuilder();

                for (var i = 0; i < messages.Length; i++)
                {

                    sb.Append(string.Format("SMS From: {0}{1}Body: {2}{1}", messages[i].OriginatingAddress,
                        System.Environment.NewLine, messages[i].MessageBody));
                }
                Toast.MakeText(context, sb.ToString(), ToastLength.Short).Show();
            }
        }
示例#12
0
		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			View view = base.GetView (context, convertView, parent);
			view.Click += delegate {
				if (TestCase.RunState != RunState.Runnable)
					return;
								
				AndroidRunner runner = AndroidRunner.Runner;
				if (!runner.OpenWriter ("Run " + TestCase.FullName, context))
					return;
				
				try {
					//Test.Run (runner);
					runner.Run (TestCase);
				} finally {
					runner.CloseWriter ();
				}

				if (Result.ResultState.Status != TestStatus.Passed) {
					Intent intent = new Intent (context, typeof(TestResultActivity));
					intent.PutExtra ("TestCase", Name);
					intent.AddFlags (ActivityFlags.NewTask);			
					context.StartActivity (intent);
				}
			};
			return view;
		}
 /**
  * Starts the activity, using the supplied driver instance.
  *
  * @param context
  * @param driver
  */
 public static void Show(Context context, UsbSerialPort port)
 {
     mUsbSerialPort = port;
     Intent intent = new Intent(context, typeof(SerialConsoleActivity));
     intent.AddFlags(ActivityFlags.SingleTop | ActivityFlags.NoHistory);
     context.StartActivity(intent);
 }
示例#14
0
        public static void goToGitHub(Context context)
        {
			//
            //Uri uriUrl = Uri.Parse("http://github.com/jfeinstein10/slidingmenu");
			Uri uriUrl = Uri.Parse("https://github.com/skywolf888/SlidingMenu.Net");
            Intent launchBrowser = new Intent(Intent.ActionView, uriUrl);
            context.StartActivity(launchBrowser);
        }
示例#15
0
 private void OpenUrl(Context context)
 {
     var intent = new Intent(context, typeof (HtmlActivity));
     intent.PutExtra("URL", Url.ToString());
     intent.PutExtra("Title", Caption);
     intent.AddFlags(ActivityFlags.NewTask);
     context.StartActivity(intent);
 }
 public void callEnded(Context context)
 {
     if (Globals.CALLED == true) {
         var intent = new Intent (context, typeof(AfterCallActivity));
         intent.AddFlags (ActivityFlags.NewTask);
         context.StartActivity (intent);
     }
 }
示例#17
0
 public static void Email(Context context, string to, string subject, string message)
 {
     Intent i = new Intent(Intent.ActionView);
     string uri = "mailto:" + to +  "?subject=" + subject + "&body=" + message;
     i.SetData(Uri.Parse(uri));
     i.PutExtra(Intent.ExtraEmail, new[] { to });
     context.StartActivity(i);
 }
示例#18
0
 /// <summary>
 /// 启动处理权限过程的 Activity
 /// </summary>
 private void StartAcpActivity()
 {
     lock (this)
     {
         Intent intent = new Intent(mContext, typeof(AcpActivity));
         intent.AddFlags(ActivityFlags.NewTask);                 //Intent.InterfaceConsts.FLAG_ACTIVITY_NEW_TASK
         mContext.StartActivity(intent);
     }
 }
        public override void OnReceive(Context context, Intent intent)
        {
            if (intent.Action == "BOOT_COMPLETED")
            {
                Intent explicitIntent = new Intent(context, typeof(Alarms));
                context.StartActivity (explicitIntent);

            }
        }
 public static void Start(Context context, string url, string title)
 {
     if (!string.IsNullOrEmpty(url) && !string.IsNullOrEmpty(title))
     {
         var intent = new Intent(context, typeof(WebViewActivity));
         intent.PutExtra(EXTRA_URL, url);
         intent.PutExtra(EXTRA_TITLE, title);
         context.StartActivity(intent);
     }
 }
示例#21
0
		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			View view = base.GetView (context, convertView, parent);
			view.Click += delegate {
				Intent intent = new Intent (context, activity);
				intent.AddFlags (ActivityFlags.NewTask);			
				context.StartActivity (intent);
			};
			return view;
		}
示例#22
0
        public static void PutData <T>(Android.Content.Context acc, object obj)
        {
            Intent intent = new Intent(acc, typeof(T));

            intent.PutExtra("objtopass", JsonConvert.SerializeObject(obj));
            MainThread.BeginInvokeOnMainThread(() =>
            {
                acc.StartActivity(intent);
            });
        }
        private async void StartCardActivityAsync(string language)
        {
            var intent = new Intent(context, typeof(CardsActivityPager));

            intent.PutExtra("position", LayoutPosition);
            intent.PutExtra("language", language);
            context.StartActivity(intent);
            await Task.Delay(928);

            SettingClick(true);
        }
示例#24
0
        public static void NavigateTo(this Android.Content.Context ctx, string url)
        {
            var intent = new Intent(ctx, Page(url));
            var param  = Param(url);

            if (string.IsNullOrEmpty(param) == false)
            {
                intent.PutExtra("param", param);
            }

            ctx.StartActivity(intent);
        }
		public override void OnReceive (Context context, Intent intent)
		{
			if (intent.Action == Intent.ActionBootCompleted) {

				if (TimeManager.GetActiveTimeEntry () != null) {
					Toast.MakeText (context, "Active task found. Restarting ETC Time App...", ToastLength.Long).Show ();
					Intent applicationIntent = new Intent (context, typeof(MainActivity));
					applicationIntent.AddFlags (ActivityFlags.NewTask);
					context.StartActivity (applicationIntent);
				}
			}
		}
        public override void OnReceive(Context context, Intent intent)
        {
#if TOMIC_ANDROID
            if (intent.Action == Intent.ActionBootCompleted)
            {
                Intent activity = new Intent(context, typeof(SplashActivity));
                activity.AddFlags(ActivityFlags.NewTask);
                activity.AddFlags(ActivityFlags.SingleTop);
                context.StartActivity(activity);
            }
#endif
        }
        public override void OnReceive(Context context, Intent intent)
        {
            Toast.MakeText(context, "Alarm showing now", ToastLength.Long).Show();
            var med = intent.GetStringExtra("MedicineName");
            int number = Convert.ToInt32(intent.GetStringExtra("NumberofTimes"));
            var title = intent.GetStringExtra("title");
            var notIntent = new Intent(context, typeof(MainActivity));
            var contentIntent = PendingIntent.GetActivity(context, 0, notIntent, PendingIntentFlags.CancelCurrent);
            var style = new NotificationCompat.BigTextStyle();
            var check = intent.GetStringExtra("CheckValue");
            NotificationManager manager = (NotificationManager)context.GetSystemService(Context.NotificationService);
            PendingIntent resultPendingIntent = PendingIntent.GetActivity(context, 0, intent, Android.App.PendingIntentFlags.UpdateCurrent);

            Android.Net.Uri alarmSound = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
            NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
                            .SetSmallIcon(Resource.Drawable.Icon)
                            .SetContentTitle("MedTrack Notification")
                            .SetContentText(String.Format("It's time to take {0}- {1} times today", med, number))
                            .SetSound(alarmSound)
                            .SetStyle(style)
                            .SetAutoCancel(true)
                            .SetContentIntent(resultPendingIntent);

            Notification notification = builder.Build();
            manager.Notify(0, notification);
            
            if(number == 2 || (intent.GetStringExtra("evening") == "true"))
            {
                var intentNew = new Intent(context, typeof(RepeatEveningAlarmActivity));
                intentNew.AddFlags(ActivityFlags.NewTask);
                context.StartActivity(intentNew);
            }
            else if((number ==3) || ((number >3 && (intent.GetStringExtra("check") == "true")))
                ||  (number >3 && (intent.GetStringExtra("afternoon") == "true")))
            {            
                var intentNew = new Intent(context, typeof(RepeatAfternoonAlarmActivity));
                intentNew.AddFlags(ActivityFlags.NewTask);             
                context.StartActivity(intentNew);
            }
        }
示例#28
0
        public static void DeregisterDevice(Context context)
        {
            try {
                new UserWS.UserSvc().DeleteUserDevice(App.GetAuthToken(context), App.GetDeviceId(context), true);
                App.setGCMCode(context, "");
                App.setDeviceId(context, -1);

                context.StartActivity(typeof(LogonActivity));
            } catch (Exception ex) {
                App.HandleException(ex, context);

            }
        }
示例#29
0
        public static void Share(Context context, Bitmap bitmap, string bitmapSavePath, string title, string subject, string message)
        {
            bitmap.SaveToFile(bitmapSavePath);

            Intent i = new Intent(Intent.ActionSend);
            i.SetType("image/png");
            i.PutExtra(Intent.ExtraSubject, subject);
            i.PutExtra(Intent.ExtraText, message);
            File f = new File(bitmapSavePath);
            i.PutExtra(Intent.ExtraStream, Uri.FromFile(f));

            context.StartActivity(Intent.CreateChooser(i, title));
        }
示例#30
0
		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			View view = base.GetView (context, convertView, parent);
			// if there are test cases inside this suite then create an activity to show them
			if (Suite.TestCaseCount > 0) {		
				view.Click += delegate {
					Intent intent = new Intent(context, typeof (TestSuiteActivity));
					intent.PutExtra ("TestSuite", Name);
					intent.AddFlags (ActivityFlags.NewTask);			
					context.StartActivity (intent);
				};
			}
			return view;
		}
示例#31
0
        private void CreateAndLaunchMailtoIntent(Android.Content.Context context, string url)
        {
            var mailto = Android.Net.MailTo.Parse(url);

            var email = new global::Android.Content.Intent(global::Android.Content.Intent.ActionSendto);

            //Set the data with the mailto: uri to ensure only mail apps will show up as options for the user
            email.SetData(global::Android.Net.Uri.Parse("mailto:"));
            email.PutExtra(global::Android.Content.Intent.ExtraEmail, mailto.To);
            email.PutExtra(global::Android.Content.Intent.ExtraCc, mailto.Cc);
            email.PutExtra(global::Android.Content.Intent.ExtraSubject, mailto.Subject);
            email.PutExtra(global::Android.Content.Intent.ExtraText, mailto.Body);

            context.StartActivity(email);
        }
示例#32
0
        protected void Navigate(Type type)
        {
            if (NavigationContext == null)
            {
                return;
            }
            if (AndroidHelpers.CurrentActivity != null && AndroidHelpers.CurrentActivity.GetType() == type)
            {
                return;
            }
//			NavigationContext.
            var intent = new Intent(NavigationContext, type);

            intent.SetFlags(ActivityFlags.NoAnimation);
            NavigationContext.StartActivity(intent);
        }
示例#33
0
 public static void clearAndExit(Context ctx)
 {
     if (ctx != new MainActivity())
     {
         Intent intent = new Intent(ctx, typeof(MainActivity));
         intent.SetFlags(ActivityFlags.ClearTop);
         Bundle bundle = new Bundle();
         bundle.PutBoolean("exit", true);
         intent.PutExtras(bundle);
         ctx.StartActivity(intent);
     }
     else
     {
         ((Activity)ctx).Finish();
     }
 }
示例#34
0
        public void NextActivity(Android.Content.Context context)
        {
            this.head++;
            if (this.head > this.Sequence.Count)
            {
                this.head = 0;
            }
            Type temp = this.parserActivity[this.Sequence[this.head]];

            Intent intent = new Intent(context, temp);

            context.StartActivity(intent);
            var x = (Activity)context;

            x.Finish();
            x.Dispose();
        }
示例#35
0
        public void PreviousActivity(Android.Content.Context context)
        {
            this.head--;
            if (this.head < 0)
            {
                this.head = 0;
            }
            Type temp = this.parserActivity[this.Sequence[this.head]];

            Intent intent = new Intent(context, temp);

            context.StartActivity(intent);
            var acContext = (Activity)context;

            acContext.Finish();
            acContext.Dispose();
        }
示例#36
0
        public static void StartMap(Context context)
        {
            var locationIntent = new Intent(Intent.ActionView);
            var prefs = PreferenceManager.GetDefaultSharedPreferences(context);
            var location = prefs.GetString(context.GetString(Resource.String.LocationPrefKey), context.GetString(Resource.String.LocationPrefDefault));

            var geoLocation = Uri.Parse("geo:0,0?").BuildUpon().AppendQueryParameter("q", location).Build();
            locationIntent.SetData(geoLocation);

            if (locationIntent.ResolveActivity(context.PackageManager) != null)
            {
                context.StartActivity(locationIntent);
            }
            else
            {
                Log.Debug("SpringTime", "Could not open activity with location: " + location);
            }
        }
示例#37
0
        public override void OnReceive(Context context, Intent intent)
        {
            Console.WriteLine("LockReceiver - OnReceive - intent.Action: {0}", intent.Action);

            if (!_activateLockScreen)
                return;

            // Create lock screen activity when the user turns off the screen.
            if (intent.Action == Intent.ActionScreenOff)
            {
                // to do: can the other activity task be hidden when showing lock screen to make sure the last activity doesn't "ghost" in the Finish animation?
                Intent newIntent = new Intent();
                newIntent.SetClass(context, typeof(LockScreenActivity));                
                // New task is required when starting an activity outside an activity.
                newIntent.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop | ActivityFlags.SingleTop | ActivityFlags.NoAnimation); 
                context.StartActivity(newIntent);
            }
        }
 static public void enter_new_password(string email, int codets, EditText otp, Android.Content.Context acc)
 {
     if (otp.Text == codets.ToString())
     {
         MainThread.BeginInvokeOnMainThread(() => {
             Intent i = new Intent(acc, typeof(Newpassword));
             i.PutExtra("email", JsonConvert.SerializeObject(email));
             acc.StartActivity(i);
         });
     }
     else
     {
         MainThread.BeginInvokeOnMainThread(() =>
         {
             Toast.MakeText(acc, "Invalid OTP entered", ToastLength.Long).Show();
         });
     }
 }
示例#39
0
        public static void ShowDialogAlert(string Title, string MessageDesc, ac.Context CurrentActivity, bool navigate = false, Activity NavigatetoActivity = null)
        {
            AlertDialog.Builder alert = new AlertDialog.Builder(CurrentActivity);
            alert.SetMessage(MessageDesc);
            alert.SetTitle(Title);
            alert.SetPositiveButton("OK", (senderAlert, args) =>
            {
                if (navigate)
                {
                    var intent = new ac.Intent(CurrentActivity, NavigatetoActivity.GetType());
                    CurrentActivity.StartActivity(intent);
                }
            });

            Dialog dialog = alert.Create();

            dialog.Show();
        }
        static public async void UserSignup(User u, Android.Content.Context acc)
        {
            HttpClient client = new HttpClient();

            var json     = JsonConvert.SerializeObject(u);
            var content  = new StringContent(json, Encoding.UTF8, "application/json");
            var uri      = BaseAddressUri + "/api/account/registernewuser";
            var response = await client.PostAsync(uri, content);

            if (response.StatusCode == HttpStatusCode.Accepted)
            {
                MainThread.BeginInvokeOnMainThread(() =>
                {
                    Toast.MakeText(acc, "Signup Sucessfull\n****Login Now****.", ToastLength.Long).Show();
                    var i = new Intent(acc, typeof(Login));
                    acc.StartActivity(i);
                });
            }
        }
示例#41
0
        public void PauseFlow(Android.Content.Context context)
        {
            Type   temp      = null;
            Intent intent    = null;
            var    acContext = (Activity)context;

            if (!this.isPaused)
            {
                temp   = new MainActivity().GetType();
                intent = new Intent(context, temp);
            }
            else
            {
                temp   = this.parserActivity[this.Sequence[this.head]];
                intent = new Intent(context, temp);
            }

            context.StartActivity(intent);
            acContext.Finish();
            acContext.Dispose();
            this.isPaused = !this.isPaused;
        }
示例#42
0
        public override void OnReceive(Context context, Intent intent)
        {
            //			var i = new Intent(context, typeof(WakeLockService));
            //			context.StartService (i);

            // PowerManager
            var power = (PowerManager)context.GetSystemService (Context.PowerService);
            var wl = power.NewWakeLock (WakeLockFlags.Full | WakeLockFlags.AcquireCausesWakeup | WakeLockFlags.OnAfterRelease, "Ruly.Ruly");
            wl.Acquire ();
            //			wl.Release ();

            // KeyguardLock
            var km = (KeyguardManager) context.GetSystemService(Context.KeyguardService);
            var klock = km.NewKeyguardLock("Ruly.Ruly");
            klock.DisableKeyguard();

            var i = new Intent(context, typeof(ShellActivity));
            i.SetFlags(ActivityFlags.NewTask | ActivityFlags.NoUserAction);
            context.StartActivity (i);

            //			ShowNotification (context, int.Parse(intent.Action));
        }
        public void OpenLocationSettings()
        {
            LocationManager LM = (LocationManager)Forms.Context.GetSystemService(Android.Content.Context.LocationService);

            if (LM.IsProviderEnabled(LocationManager.GpsProvider) == false)
            {
                AlertDialog ad = new AlertDialog.Builder(this).Create();

                ad.SetMessage("Please open location");
                ad.SetCancelable(false);
                ad.SetCanceledOnTouchOutside(false);
                ad.SetButton("ok", delegate
                {
                    Android.Content.Context ctx = Forms.Context;
                    ctx.StartActivity(new Intent(Android.Provider.Settings.ActionLocationSourceSettings));
                });

                ad.SetButton2("cancle", delegate
                {
                });
                ad.Show();
            }
        }
示例#44
0
        public override void OnReceive(Context context, Intent intent)
        {
            switch (intent.Action)
            {
            case AppWidgetManager.ActionAppwidgetUpdate:
                var updateValue = intent.GetStringExtra(KEY_CLICKUPDATE);
                isClick = updateValue?.Equals(VALUE_CLICKUPDATE) ?? false;
                break;

            case Intent.ActionMain:
                var runValue = intent.GetStringExtra(KEY_RUNAPP);

                if (runValue?.Equals(VALUE_RUNAPP) ?? false)
                {
                    var runIntent = new Intent(context, typeof(SplashActivity));
                    runIntent.SetFlags(ActivityFlags.NewTask);
                    context.StartActivity(runIntent);
                }
                break;
            }

            base.OnReceive(context, intent);
        }
 protected virtual void StartActivity(Context context, Intent intent, IDataContext dataContext)
 {
     var activity = context.GetActivity();
     Action<Context, Intent, IDataContext> startAction = null;
     if (activity != null)
         startAction = activity.GetBindingMemberValue(AttachedMembers.Activity.StartActivityDelegate);
     if (startAction == null)
         context.StartActivity(intent);
     else
         startAction(context, intent, dataContext);
 }
示例#46
0
        public void GotoPage(Type activityType)
        {
            Intent intent = new Intent(Context, activityType);

            Context.StartActivity(intent);
        }
 protected virtual void StartActivity(Context context, Intent intent, IDataContext dataContext)
 {
     context.StartActivity(intent);
 }
示例#48
0
文件: Util.cs 项目: pythe/wristpass
        public static void GotoUrl(Context context, String url)
        {
            if ( !string.IsNullOrEmpty(url) ) {

                if (url.StartsWith("androidapp://"))
                {
                    string packageName = url.Substring("androidapp://".Length);
                    Intent startKp2aIntent = context.PackageManager.GetLaunchIntentForPackage(packageName);
                    if (startKp2aIntent != null)
                    {
                        startKp2aIntent.AddCategory(Intent.CategoryLauncher);
                        startKp2aIntent.AddFlags(ActivityFlags.NewTask);
                        context.StartActivity(startKp2aIntent);
                    }
                }
                else
                {
                    Uri uri = Uri.Parse(url);
                    context.StartActivity(new Intent(Intent.ActionView, uri));
                }
            }
        }