All Projects → Azure-Samples → Storage Blob Xamarin Image Uploader

Azure-Samples / Storage Blob Xamarin Image Uploader

Licence: mit
This sample demostrates how to use the Azure Blob Storage with Xamarin for Android, iOS and Windows Phone

services: storage platforms: xamarin author: pcibraro

Azure Storage Service - Photo Uploader Sample using Xamarin for Android, iOS and Windows.

This sample demostrates how to upload photo images from the gallery in Android, iOS and Windows Phone into a Block blob in Azure Storage with Xamarin. It shows a button "Select Image" to select an image from the gallery, a button "Upload Image" to upload it to the Azure Storage, a button "List images" to list all the uploaded images. A Shared Asset Project is used for reusing all the common code for the platform specific projects.

Note: This sample uses the Windows Azure Storage client library for .NET available through a Nuget package.

If you don't have a Microsoft Azure subscription you can get a FREE trial account here.

Running this sample in Windows with Visual Studio

This sample can be run using either the Azure Storage Emulator that installs as part of the Windows Azure SDK - or by updating the StorageConnectionString variable defined at Configuration.cs file in the Shared Native Library Project.

To run the sample using the Storage Emulator (Windows Azure SDK / Only on Windows):

  1. Download and Install the Azure Storage Emulator here.
  2. Start the Azure Storage Emulator (once only) by pressing the Start button or the Windows key and searching for it by typing "Azure Storage Emulator". Select it from the list of applications to start it.
  3. Set breakpoints and run the project using F10.

To run the sample using the Storage Service

  1. Open the Configuration.cs file in the Shared Native Library Project "XamarinImageUploader". Replace the StorageConnectionString variable (UseDevelopmentStorage=True) with the connection string for the storage service (AccountName=[]...)
  2. Create a Storage Account through the Azure Portal and provide your [AccountName] and [AccountKey] in the StorageConnectionString variable.
  3. Set breakpoints and run the project using F10.

WARNING: Only use Shared Key authentication for testing purposes! Your account name and account key, which give full read/write access to the associated Storage account, will be distributed to every person that downloads your app. This is not a good practice as you risk having your key compromised by untrusted clients. Please consult following documents to understand and use Shared Access Signatures instead. https://docs.microsoft.com/en-us/rest/api/storageservices/delegating-access-with-a-shared-access-signature and https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1

Note: You can also run the sample with Xamarin Studio, but only the Android and iOS samples will be available. For the Windows Phone sample, you can only use Visual Studio.

More information

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].