コード例 #1
0
        void SampleSelected(object sender, AdapterView.ItemClickEventArgs e)
        {
            var position = e.Position;

            if (position == 0)
            {
                var geoUri    = AndroidUri.Parse("geo:42.374260,-71.120824");
                var mapIntent = new Intent(Intent.ActionView, geoUri);
                StartActivity(mapIntent);
                return;
            }
            Dictionary <double, double> list = new Dictionary <double, double>
            {
                { 51.507351, -0.127758 }
            };

            Intent intent = new Intent(this, typeof(MapWithMarkersActivity));

            //   intent.PutExtra("User", JsonConvert.SerializeObject(list));
            intent.PutExtra("locationCode", 1);
            //intent.PutExtra("cordinate",)
            this.StartActivity(intent);



            // var sampleToStart = SampleMetaDataList[position];
            //sampleToStart.Start(this);
        }
コード例 #2
0
        public void PickSoundForNotificationChannel()
        {
            if (NotificationChannelsApiCheck())
            {
                return;
            }

            AGFilePicker.PickAudio(audioFile =>
            {
                _soundFilePath = AndroidUri.FromFile(audioFile.OriginalPath).CallStr("getPath");
                Debug.Log(_soundFilePath);
                AGUIMisc.ShowToast(_soundFilePath);
            },
                                   error => AGUIMisc.ShowToast("Cancelled picking audio file"));
        }
コード例 #3
0
        void SampleSelected(object sender, AdapterView.ItemClickEventArgs e)
        {
            var position = e.Position;

            if (position == 0)
            {
                var geoUri    = AndroidUri.Parse("geo:42.374260,-71.120824");
                var mapIntent = new Intent(Intent.ActionView, geoUri);
                StartActivity(mapIntent);
                return;
            }


            var sampleToStart = SampleMetaDataList[position];

            sampleToStart.Start(this);
        }
コード例 #4
0
        internal static AndroidUri GetShareableFileUri(string filename)
        {
            Java.IO.File sharedFile;
            //if (FileProvider.IsFileInPublicLocation(filename))
            //{
            //    // we are sharing a file in a "shared/public" location
            //    sharedFile = new Java.IO.File(filename);
            //}
            //else
            //{
            var rootDir = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                                       filename);
            //var rootDir = System.Environment.GetFolderPath(Environment.SpecialFolder.Personal);// FileProvider.GetTemporaryDirectory();

            // create a unique directory just in case there are multiple file with the same name
            var tmpDir = new Java.IO.File(rootDir, Guid.NewGuid().ToString("N"));

            tmpDir.Mkdirs();
            tmpDir.DeleteOnExit();

            // create the new temprary file
            var tmpFile = new Java.IO.File(tmpDir, System.IO.Path.GetFileName(filename));

            System.IO.File.Copy(filename, tmpFile.CanonicalPath);
            tmpFile.DeleteOnExit();

            sharedFile = tmpFile;
            //}

            // create the uri
            if (HasApiLevelN)
            {
                var providerAuthority = AppContext.PackageName + ".fileProvider";
                return(FileProvider.GetUriForFile(
                           AppContext.ApplicationContext,
                           providerAuthority,
                           sharedFile));
            }

            return(AndroidUri.FromFile(new Java.IO.File(filename)));
        }