Welcome to Xamarin Guy Show Blog

Keep updated for latest and Greatest Posts from Xamarin guy

Clubbing System.IO storage and SQLite Storage to get Time Stamping Upload and Download Feature Xamarin Forms #Tutorial 21

Hey Guy’s i have been asked with so many SQL  and System.IO Question’s in Xamarin forms.

1) How do i store image, video , pdf’s or any stuffs in Both android and IOS.?
2) How do i retrieve back all the items in the form of list.
3) Whether to use Android and IOS Platform storage or SQLite storage.?
4) How do i create a time stamp so that if item is downloaded from server it need not to be downloaded until next update. ?
5) How do i make use of SQlite for storing Files and Stuff’s?

No worries Guy’s we can do everything. I will update this Post until i make a perfect one. Keep Calm and keep supporting.

Model 1 : In module 1 we are going to store strings inside app using SQLite storage
Module 2 : In Module 2 we are going to store files to internal storage using System.IO

Module1

Step 1 :
Add nuget package https://www.nuget.org/packages/sqlite-net-pcl/

Step 2 :

 


Inside IOS project: (SQLiteDependecy.cs)

 

Step 3 :
Inside Android Project: (SQLiteDependecy.cs)

Step 4 :
Inside Xamarin Forms Project:


Now we are going to create Interface folder : (SqlInterface) and create a interface class as ISQLiteInterface.cs

Step 5:
Inside Models Folder we are going to create a class (MyStorageModel.cs)

Step 6:
Now create a page which will call the connection and store all the items.
CheckSql.cs

Step 7:
CheckSql.xaml.cs

Module 2 : Using System.IO Storage inside Xamarin forms
Note use Permission Plugin to give permission to download files inside internal storage for both android and IOS.

Step 1 :

Inside Android Platform specific Project:

MainActivity.cs


MainApplication.cs

Step 2 : 

Inside IOS Platform Specific Project

Step 3 : 

Inside Xamarin Forms Project

FileExtensions.cs

Inside MainPage.xaml

Inside MainPage.xaml.cs

Module 3 :
Now it’s time to club both storage 😀

Expected OutPut  For Both Android and IOS:

 

 

 

 

 

 

 1,287 total views,  1 views today

Leave a Reply