public void OpenModal(string key)
        {
            var activityType = _pageKeys[key];

            var intent = new Intent(Application.Context, activityType);
            intent.SetFlags(ActivityFlags.NoHistory);
            intent.SetFlags (ActivityFlags.NewTask);

            Application.Context.StartActivity(intent);
        }
 private void ShareOnService(string status, string title = "", string link = "")
 {
     var intent = new Intent(global::Android.Content.Intent.ActionSend);
     intent.PutExtra(global::Android.Content.Intent.ExtraText, String.Format("{0} - {1}",status ?? string.Empty,link ?? string.Empty));
     intent.PutExtra(global::Android.Content.Intent.ExtraSubject, title ?? string.Empty);
     intent.SetType("text/plain");
     intent.SetFlags(ActivityFlags.ClearTop);
     intent.SetFlags(ActivityFlags.NewTask);
     Android.App.Application.Context.StartActivity(intent);
 }
    public void SendSms(string body, string phoneNumber)
    {
      var smsUri = Android.Net.Uri.Parse("smsto:" + phoneNumber);
      var smsIntent = new Intent(Intent.ActionSendto, smsUri);
      smsIntent.PutExtra("sms_body", body);
      smsIntent.PutExtra(Intent.ExtraText, body);

      //these flags are required when using application context
      smsIntent.SetFlags(ActivityFlags.ClearTop);
      smsIntent.SetFlags(ActivityFlags.NewTask);
      Android.App.Application.Context.StartActivity(smsIntent);
    }
        public async Task ShareUrl(string url, string title = null, string subject = null)
        {
            var intent = new Intent(Intent.ActionSend);
            intent.SetType("text/plain");
            intent.PutExtra(Intent.ExtraText, url);
            intent.PutExtra(Intent.ExtraSubject, subject ?? string.Empty);

            intent.SetFlags(ActivityFlags.ClearTop);
            intent.SetFlags(ActivityFlags.NewTask);
            var chooserIntent = Intent.CreateChooser(intent, title ?? string.Empty);
            Android.App.Application.Context.StartActivity(chooserIntent);

        }
 private bool TryIntent(Intent intent)
 {
   try
   {
     intent.SetFlags(ActivityFlags.ClearTop);
     intent.SetFlags(ActivityFlags.NewTask);
     Android.App.Application.Context.StartActivity(intent);
     return true;
   }
   catch(ActivityNotFoundException)
   {
     return false;
   }
 }
Exemplo n.º 6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++); };

            var file = fileFromAsset(this, "test.pdf");

            //var uri = Android.Net.Uri.FromFile(new File("file:///android_asset/test.pdf"));

            var uri = Android.Net.Uri.Parse(file.AbsolutePath);
            var intent = new Intent (this, typeof (MuPDFActivity));
            intent.SetFlags (ActivityFlags.NoHistory);
            intent.SetAction (Intent.ActionView);
            intent.SetData(uri);
            this.StartActivity(intent);
        }
 public void EnableVoiceSynthesisEngine()
 {
     Intent intent = new Intent();
     intent.SetAction("com.android.settings.TTS_SETTINGS");
     intent.SetFlags(ActivityFlags.NewTask);
     CurrentActivity.StartActivity(intent);
 }
Exemplo n.º 8
0
 public override void OnBackPressed()
 {
     intent = new Intent(this, typeof(SetUpActivity));
     intent.PutExtra("content", SetUpActivity.TERMINATE);
     intent.SetFlags(ActivityFlags.ClearTop);
     StartActivity(intent);
 }
		protected override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id)
		{
			var intent = new Intent(this, typeof (GameActivity));
			intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop);
			intent.PutExtra("Type", sampleTypes[position].AssemblyQualifiedName);
			StartActivity(intent);
		}
Exemplo n.º 10
0
        public void InstallAPK_MoreThanAndroid7(Java.IO.File apkFileToInstall)
        {
            Android.Content.Intent intent = new Android.Content.Intent();
            intent.SetAction(Android.Content.Intent.ActionView);

            if (string.IsNullOrWhiteSpace(mFileProvider_Authority))
            {
                throw new Exception("mFileProvider_Authority为空值。请使用 SetFileProvider_Authority(string) 方法设置 mFileProvider_Authority 的值。");
            }

            Android.Net.Uri uri = Android.Support.V4.Content.FileProvider.GetUriForFile
                                  (
                context: mAppActivity.ApplicationContext,
                authority: mFileProvider_Authority,
                file: apkFileToInstall
                                  );

            intent.SetDataAndType(uri, "application/vnd.android.package-archive");

            intent.SetFlags(Android.Content.ActivityFlags.NewTask); // SetFlags 一定要在 Add Flags 之前, 否则 Add Flags 会被覆盖
            intent.AddFlags(Android.Content.ActivityFlags.GrantReadUriPermission);
            intent.AddFlags(Android.Content.ActivityFlags.GrantWriteUriPermission);

            mAppActivity.Application.StartActivity(intent);
        }
Exemplo n.º 11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.QuestionnaireSummary);
            int Ergebnis = Intent.GetIntExtra ("ergebnis", 0);

            TextView ErgebnisText = FindViewById<TextView> (Resource.Id.textView3);
            ErgebnisText.Text = string.Format ("{0} {1}", Resources.GetText (Resource.String.total_score), Ergebnis);

            Button ContinueHome = FindViewById<Button> (Resource.Id.button1);
            ContinueHome.Click += delegate {
                //create an intent to go to the next screen
                Intent intent = new Intent(this, typeof(Home));
                intent.SetFlags(ActivityFlags.ClearTop); //remove the history and go back to home screen
                StartActivity(intent);
            };

            //Toast.MakeText (this, string.Format ("{0}", DateTime.Now.ToString("dd.MM.yy HH:mm")), ToastLength.Short).Show();

            ContentValues insertValues = new ContentValues();
            insertValues.Put("date_time", DateTime.Now.ToString("dd.MM.yy HH:mm"));
            insertValues.Put("ergebnis", Ergebnis);
            dbRUOK = new RUOKDatabase(this);
            dbRUOK.WritableDatabase.Insert ("RUOKData", null, insertValues);

            //The following two function were used to understand the usage of SQLite. They are not needed anymore and I just keep them in case I wanna later look back at them.
            //InitializeSQLite3(Ergebnis);
            //ReadOutDB ();
        }
Exemplo n.º 12
0
 public void Show()
 {
     Intent intent = new Intent(Intent.ActionView);
     intent.SetData(Android.Net.Uri.Parse(Uri.OriginalString));
     intent.SetFlags(ActivityFlags.NewTask);
     Application.Context.StartActivity(intent);
 }
Exemplo n.º 13
0
 public override void OnBackPressed()
 {
     var StartMain = new Intent (Intent.ActionMain);
     StartMain.AddCategory (Intent.CategoryHome);
     StartMain.SetFlags (ActivityFlags.NewTask);
     StartActivity (StartMain);
 }
Exemplo n.º 14
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView (inflater, container, savedInstanceState);
            var view = inflater.Inflate (Resource.Layout.DocumentFragmentLayout, null, true);

            documentListView = view.FindViewById<ListView> (Resource.Id.documentsListView);
            if (Documents != null)
                documentListView.Adapter = new DocumentsAdapter (Activity, Resource.Layout.DocumentListItemLayout, Documents);

            documentListView.ItemClick += (sender, e) => {
                var textView = e.View.FindViewById<TextView> (Resource.Id.documentListItemDocTitle);

                var document = Documents.ElementAtOrDefault ((int)textView.Tag);

                //start intent with the uri path of the document
                var strings = document.Path.Split ('/');
                CopyReadAsset (strings [1]);
                var intent = new Intent (Intent.ActionView);
                var uri = Uri.FromFile (file);
                intent.SetDataAndType (uri, "application/pdf");
                intent.SetFlags (ActivityFlags.ClearTop);
                try {
                    Activity.StartActivity (intent);
                } catch (ActivityNotFoundException exc) {
                    Log.WriteLine (LogPriority.Error, Constants.LogTag, exc.Message);
                }
            };

            return view;
        }
Exemplo n.º 15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //Création d'un user avec 1 group pour tester l'appli
            User user1 = new User("user", "one", "us1", "mail", "password");
            user1.userId = users_db.Count + 1;
            users_db.Add(user1.userId, user1);

            Group grp = new Group("Grp1", user1);
            user1.addGroup(grp);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Vérification de la connexion
            VerifyConnection();

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.versConnexionButton);

            button.Click += delegate {
                Intent intent = new Intent(this.ApplicationContext, typeof(LoginActivity));
                intent.SetFlags(ActivityFlags.NewTask);
                StartActivity(intent);
            };
        }
Exemplo n.º 16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SupportActionBar.Hide();
            SetContentView(Resource.Layout.Login);
            loginViewModel = new LoginViewModel();
            ServiceLocator.Dispatcher = new DispatchAdapter(this);
            loginField = FindViewById<EditText>(Resource.Id.username);
            passwordField = FindViewById<EditText>(Resource.Id.password);
            submit = FindViewById<Button>(Resource.Id.submit);
            submit.SetOnClickListener(this);

            ServiceLocator.Messenger.Subscribe<BaseViewMessage>(m => 
            {
                switch (m.Content.message) 
                {
                    case BaseViewMessage.MessageTypes.CONNECTION_ERROR:
                        Toast.MakeText(this, "Erro de conexão", ToastLength.Short).Show();
                        break;
                    case BaseViewMessage.MessageTypes.LOGIN_CONNECTION_OK:
                        getCourses();
                        break;
                    case BaseViewMessage.MessageTypes.COURSE_CONNECTION_OK:
                        intent = new Intent(this, typeof(CoursesActivity));
                        intent.SetFlags(ActivityFlags.ClearTop);
                        StartActivity(intent);
                        break;
                    default:
                        break;
                }            
            });
        }
		public void DidEnterRegion(AltBeaconOrg.BoundBeacon.Region region)
		{
			// In this example, this class sends a notification to the user whenever a Beacon
			// matching a Region (defined above) are first seen.
			Log.Debug(TAG, "did enter region.");
			if (!haveDetectedBeaconsSinceBoot) 
			{
				Log.Debug(TAG, "auto launching MonitoringActivity");

				// The very first time since boot that we detect an beacon, we launch the
				// MainActivity
				var intent = new Intent(this, typeof(MainActivity));
				intent.SetFlags(ActivityFlags.NewTask);
				// Important:  make sure to add android:launchMode="singleInstance" in the manifest
				// to keep multiple copies of this activity from getting created if the user has
				// already manually launched the app.
				this.StartActivity(intent);
				haveDetectedBeaconsSinceBoot = true;
			} 
			else 
			{
				if (mainActivity != null) {
					Log.Debug(TAG, "I see a beacon again");
				} 
				else 
				{
					// If we have already seen beacons before, but the monitoring activity is not in
					// the foreground, we send a notification to the user on subsequent detections.
					Log.Debug(TAG, "Sending notification.");
					SendNotification();
				}
			}
		}
Exemplo n.º 18
0
        private void LaunchFile(int index)
        {
            Bundle bundle;

            if (AppConstant.IsQPOffline(SystemPath.GetFileName(semesters[semesterIndex].Years[yearIndex].QuestionPapers[index].FileLink.ToString())))
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", true);
                bundle.PutString("PATH", SystemPath.Combine(AppConstant.QPFolderPath, SystemPath.GetFileName(semesters[semesterIndex].Years[yearIndex].QuestionPapers[index].FileLink.ToString())));
            }
            else
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", false);

                bundle.PutString("URL", semesters[semesterIndex].Years[yearIndex].QuestionPapers[index].FileLink.ToString());
                bundle.PutBoolean("IsFileNotice", false);
            }

            if (Looper.MyLooper() == null)
            {
                Looper.Prepare();
            }

            Android.Content.Intent i = new Android.Content.Intent(this, typeof(PDFViewerActivity));
            i.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
            i.PutExtras(bundle);
            StartActivity(i);
        }
 public void Show()
 {
     Intent intent = new Intent(Intent.ActionView);
     intent.SetData(Uri.Parse("market://details?id=" + Application.Context.PackageName));
     intent.SetFlags(ActivityFlags.NewTask);
     Application.Context.StartActivity(intent);
 }
        public void SetHeader(String title, bool btnHomeVisible, bool btnFeedbackVisible)
        {
            ViewStub stub = (ViewStub) FindViewById(Resource .Id .vsHeader);
              		View inflated = stub.Inflate();

            TextView txtTitle = (TextView) inflated.FindViewById(Resource.Id.txtHeading );
            txtTitle.Text=title;

            Button btnHome = (Button) inflated.FindViewById(Resource .Id.btnHome );

            if(!btnHomeVisible)
                btnHome.Visibility = Android.Views .ViewStates .Invisible ;

            btnHome .Click+= delegate(object sender, EventArgs e) {

                 Intent intent = new Intent(this.ApplicationContext , typeof (HomeActivity ));
              		 intent.SetFlags (ActivityFlags.ClearTop );
              		 StartActivity(intent);
            };

            Button btnFeedback = (Button) inflated.FindViewById( Resource.Id.btnFeedback);
            if(!btnFeedbackVisible)
                btnFeedback.Visibility = Android.Views .ViewStates .Invisible ;

            btnFeedback .Click += delegate(object sender, EventArgs e) {
                 Intent intent = new Intent(this.ApplicationContext , typeof (ActivityFeedback));
              		 intent.SetFlags (ActivityFlags.ClearTop );
              		 StartActivity(intent);

            };
        }
Exemplo n.º 21
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);*/
            }
        }
Exemplo n.º 22
0
 public static void OpenGallery(Context context)
 {
     Intent intent = new Intent(Intent.ActionView);
     intent.SetType("image/*");
     intent.SetFlags(ActivityFlags.NewTask);
     context.StartActivity(intent);
 }
Exemplo n.º 23
0
 private void InstallAPK_Simple(Java.IO.File apkFileToInstall)
 {
     Android.Content.Intent intent = new Android.Content.Intent();
     intent.SetAction(Android.Content.Intent.ActionView);
     intent.SetFlags(Android.Content.ActivityFlags.NewTask);
     intent.SetDataAndType(Android.Net.Uri.FromFile(apkFileToInstall), "application/vnd.android.package-archive");
     mAppActivity.Application.StartActivity(intent);
 }
Exemplo n.º 24
0
 public override bool OnSearchRequested()
 {
     Intent i = new Intent(this, typeof(SearchActivity));
     AppTask.ToIntent(i);
     i.SetFlags(ActivityFlags.ForwardResult);
     StartActivity(i);
     return true;
 }
Exemplo n.º 25
0
        /// <summary>
        /// Open a browser to a specific url
        /// </summary>
        /// <param name="url">Url to open</param>
        /// <returns>awaitable Task</returns>
        public async Task OpenBrowser(string url)
        {
            try
            {
                var intent = new Intent(Intent.ActionView);
                intent.SetData(Android.Net.Uri.Parse(url));

                intent.SetFlags(ActivityFlags.ClearTop);
                intent.SetFlags(ActivityFlags.NewTask);
                Android.App.Application.Context.StartActivity(intent);

            }
            catch (Exception ex)
            {
                Console.WriteLine("Unable to open browser: " + ex.Message);
            }
        }
 public Intent DisplayPDF(Java.IO.File file)
 {
     Intent intent = new Intent (Intent.ActionView);
     Android.Net.Uri filepath = Android.Net.Uri.FromFile (file);
     intent.SetDataAndType (filepath, "application/pdf");
     intent.SetFlags (ActivityFlags.ClearTop);
     return intent;
 }
        public void OpenModal(string key, object parameter)
        {
            var activityType = _pageKeys[key];

            var intent = new Intent(Application.Context, activityType);
            intent.SetFlags(ActivityFlags.NoHistory);
            intent.SetFlags(ActivityFlags.NewTask);

            var field = this.GetType().BaseType.GetField("_parametersByKey", BindingFlags.Instance | BindingFlags.NonPublic);

            var parameters = field.GetValue(this) as Dictionary<string, object>;

            var guid = Guid.NewGuid().ToString();
            parameters.Add(guid, parameter);
            intent.PutExtra(ParameterKeyName, guid);

            Application.Context.StartActivity(intent);
        }
Exemplo n.º 28
0
 public override void OnBackPressed()
 {
     Intent intent = new Intent(Intent.ActionMain);
     intent.AddCategory(Intent.CategoryHome);
     intent.SetFlags(ActivityFlags.ClearTop);
     StartActivity(intent);
     Finish();
     Process.KillProcess(Process.MyPid());
 }
Exemplo n.º 29
0
        protected override void OnResume ()
        {
            base.OnResume ();

            if (LoginViewModel.ShouldShowLogin (Android.Application.LastUseTime)) {
                var intent = new Intent (this, typeof (LoginActivity));
                intent.SetFlags (ActivityFlags.ClearTop);
                StartActivity(intent);
            }
        }
Exemplo n.º 30
0
		public override bool OnKeyUp (Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				Intent intent = new Intent(Intent.ActionMain);
				intent.AddCategory(Intent.CategoryHome);
				intent.SetFlags(ActivityFlags.NewTask);
				StartActivity(intent);
			}
			return true;
		}
Exemplo n.º 31
0
        public void ShowInExternalBrowser(string url)
        {
            try
            {
                var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(url));
                intent.SetFlags(ActivityFlags.NewTask);            
                Application.Context.StartActivity(intent);

            } catch(Exception e){ }
        }
Exemplo n.º 32
0
 public static void StartActivityForResult(this object o, Intent intent)
 {
     var context = o as Context;
     if (context != null) {
         context.StartActivityForResult (intent);
     } else {
         intent.SetFlags (ActivityFlags.NewTask);
         Application.Context.StartActivityForResult (intent);
     }
 }
		public LandingPageRenderer ()
		{
			MessagingCenter.Subscribe<LandingPage> (this, "RedLaserScan", (sender) => {
				// do something whenever the "Hi" message is sent

				Intent intent = new Intent(Context,typeof(RedLaserActivity));
				intent.SetFlags(ActivityFlags.NewTask);
				this.Context.ApplicationContext.StartActivity(intent);
			});
		}
Exemplo n.º 34
0
        private void LaunchPlacements(int position)
        {
            Bundle         bundle = new Bundle();
            Intent         i      = new Android.Content.Intent(this, typeof(NewsEventViewer));
            IList <string> images = ConvertToStringList(placementList[position].Images);

            bundle.PutString("CONTENT", placementList[position].Content);
            bundle.PutStringArrayList("IMAGES", images);

            i.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
            i.PutExtras(bundle);

            StartActivity(i);
        }
Exemplo n.º 35
0
        private void LaunchOfflineQP(int index)
        {
            Bundle bundle = new Bundle();

            bundle.PutBoolean("IsFileOffline", true);
            bundle.PutString("PATH", listOffline[index].FilePath);

            if (Looper.MyLooper() == null)
            {
                Looper.Prepare();
            }

            Android.Content.Intent i = new Android.Content.Intent(this, typeof(PDFViewerActivity));
            i.SetFlags(Android.Content.ActivityFlags.NewTask | Android.Content.ActivityFlags.ClearTop);
            i.PutExtras(bundle);
            this.StartActivity(i);
        }
Exemplo n.º 36
0
 public void Push(INavigationItem item)
 {
     if (items.Count > 0)
     {
         var intent = new ac.Intent(Control.Context, typeof(EtoNavigationActivity));
         var key    = Guid.NewGuid().ToString();
         itemsLookup.Add(key, item);
         intent.PutExtra("item", key);
         intent.SetFlags(ac.ActivityFlags.NewTask);
         aa.Application.Context.StartActivity(intent);
     }
     else
     {
         SetContent(item.Content);
     }
     items.Push(item);
 }
Exemplo n.º 37
0
        private void LaunchOfflineNotice(int index)
        {
            Bundle bundle;

            Android.Content.Intent i;

            if (listOffline[index].FileExtension.ToLower().Contains("jpg") || listOffline[index].FileExtension.ToLower().Contains("png") || listOffline[index].FileExtension.ToLower().Contains("jpeg"))
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", true);
                bundle.PutString("PATH", listOffline[index].FilePath);

                if (Looper.MyLooper() == null)
                {
                    Looper.Prepare();
                }

                i = new Android.Content.Intent(this, typeof(ImageViewerActivity));
                i.SetFlags(Android.Content.ActivityFlags.NewTask | Android.Content.ActivityFlags.ClearTop);
                i.PutExtras(bundle);
                this.StartActivity(i);
            }
            else if (listOffline[index].FileExtension.ToLower().Contains("pdf"))
            {
                bundle = new Bundle();
                bundle.PutBoolean("IsFileOffline", true);
                bundle.PutString("PATH", listOffline[index].FilePath);

                if (Looper.MyLooper() == null)
                {
                    Looper.Prepare();
                }

                i = new Android.Content.Intent(this, typeof(PDFViewerActivity));
                i.SetFlags(Android.Content.ActivityFlags.NewTask | Android.Content.ActivityFlags.ClearTop);
                i.PutExtras(bundle);
                this.StartActivity(i);
            }
        }