protected override void OnCreate(Bundle bundle) { Window.SetSoftInputMode(Android.Views.SoftInput.AdjustResize); this.CheckAppPermissions(); base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); this._app = new App(); LoadApplication(this._app); // method is new in 1.3 // Handle shared image if (Intent.Action == Intent.ActionSend && Intent.Extras.ContainsKey(Intent.ExtraStream)) { var uri = (Android.Net.Uri)Intent.Extras.GetParcelable(Intent.ExtraStream); this._sharedIntentImages = new List <Android.Net.Uri> { uri }; var images = SharedContentResolver.CreateUploadImagesNoData(ApplicationContext, this._sharedIntentImages); this._app.SetSharedImageDetailsToUpload(images); this._app.ImageDataRequested += App_SharedImageDataRequested; } // Handle multiple shared images else if (Intent.Action == Intent.ActionSendMultiple) { this._sharedIntentImages = Intent.Extras.GetParcelableArrayList(Intent.ExtraStream); var images = SharedContentResolver.CreateUploadImagesNoData(ApplicationContext, this._sharedIntentImages); this._app.SetSharedImageDetailsToUpload(images); this._app.ImageDataRequested += App_SharedImageDataRequested; } }
private void App_SharedImageDataRequested(object sender, ImageDataRequestedEventArgs e) { if (this._sharedIntentImages != null && e.Source == UploadImages.ImageSource.AndroidShare) { var imageWithData = SharedContentResolver.CreateUploadImageWithData(e.Index, ApplicationContext, this._sharedIntentImages); this._app.SetSharedImageDataToUpload(imageWithData); } }