Links

Xamarin

Learn how to connect your Xamarin app to Filebase.

What is Xamarin?

Xamarin is a mobile application development platform for Windows, iOS and Android applications. An Xamarin app can be built with the .NET and C# frameworks using Xamarin Studio or in Microsoft's Visual Studio. The AWS Transfer Utility can be configured within an Xamarin app to connect to Filebase.

Prerequisites:

  • Download and install Visual Studio (Version 2019 or older).
  • Sign up for a free Filebase account.
  • Have your Filebase Access and Secret Keys. Learn how to view your access keys here.
  • Create a Filebase Bucket. Learn how to create a bucket here.

1. Install the 'Mobile Development with .NET' Tool Package for Visual Studio.

This workload package includes the templates and frameworks for Xamarin.

2. Create or open a Visual Studio project.

3. Within your Visual Studio project, view your SolutionExplorer > Packages > Manage NuGet Packages.

4. Browse for and install the following NuGets:

  • AWSSDK.S3
  • AwsSignatureVersion4

5. Configure your Xamarin app as desired for use with Filebase.

Xamarin includes a wide range of implementation for creating Android, iOS, and Windows Applications. This code snippet is a single example of a stand alone file download. This does not include other application functionality, such as a User Interface or Button configuration. Filebase is unable to provide specific configurations for custom applications due to their individualized nature.

The following code example showcases how to download a file from Filebase:

using System;
using System.IO;
using Amazon.S3;
using Amazon.S3.Model;
using Amazon.S3.Util;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
AmazonS3Config s3Config = new AmazonS3Config
{
ServiceURL = "https://s3.filebase.com",
};
var accessKey = "Filebase Access Key";
var secretKey = "Filebase Secret Key";
var s3Client = new AmazonS3Client(accessKey, secretKey, s3Config);
var transferUtility = new Amazon.S3.Transfer.TransferUtility(s3Client);
transferUtility.Download("Local/Path/To/Download/File/File.name",
"Filebase-Bucket-Name",
"Object-Name-To-Download");
}
}
}
Edit this code with your:
  • Filebase Access Key
  • Filebase Secret Key
  • Local Path Where To Download The File To
  • Filebase Bucket Name
  • Object Name to be Downloaded

The following code example showcases how to upload a file to Filebase:

using System;
using System.IO;
using Amazon.S3;
using Amazon.S3.Model;
using Amazon.S3.Util;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
AmazonS3Config s3Config = new AmazonS3Config
{
ServiceURL = "https://s3.filebase.com",
};
var accessKey = "Filebase Access Key";
var secretKey = "Filebase Secret Key";
var s3Client = new AmazonS3Client(accessKey, secretKey, s3Config);
var transferUtility = new Amazon.S3.Transfer.TransferUtility(s3Client);
transferUtility.Upload("Local/Path/To/File/To/Upload",
"Filebase-Bucket-Name");
}
}
}
Edit this code with your:
  • Filebase Access Key
  • Filebase Secret Key
  • Local Path Where The File To Upload Is Located
  • Filebase Bucket Name
If you have any questions, please join our Discord server, or send us an email at [email protected]