SupportMediaXF 1.0.0
Take & Pick Photos Plugin for Xamarin Forms, Simple cross platform plugin to take photos or pick them from a gallery from shared code
Install-Package SupportMediaXF -Version 1.0.0
dotnet add package SupportMediaXF --version 1.0.0
<PackageReference Include="SupportMediaXF" Version="1.0.0" />
paket add SupportMediaXF --version 1.0.0
#r "nuget: SupportMediaXF, 1.0.0"
SupportMediaXF
Simple cross platform plugin to take photos or pick them from a gallery from shared code
Setup for iOS project
Add to AppDelegate before LoadApplication
SupportMediaXFSetup.Initialize();
Add privacy to info.plist
- Privacy - Camera Usage Description
- Privacy - Photo Library Usage Description
Setup for Android project
Add to MainActivity before LoadApplication
SupportMediaXFSetup.Initialize(this);
Add permisison to manifest
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera2.full" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
Create new file_paths file in xml Resource then Add provider in application tag
<provider android:authorities="[Your application package]"
android:exported="false"
android:grantUriPermissions="true"
android:name="android.support.v4.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider>
USAGE
Implements interface to your viewmodel to receive photos
ISupportMediaResultListener
Open Camera to Gallery by
DependencyService.Get<ISupportMedia>().IF_OpenCamera(this, new SyncPhotoOptions(), [Code Request]);
Configuration output
public class SyncPhotoOptions
{
public int Width { set; get; }
public int Height { set; get; }
public float Quality { set; get; }
public SyncPhotoOptions()
{
Width = 1280;
Height = 960;
Quality = 0.8f;
}
}
SupportMediaXF
Simple cross platform plugin to take photos or pick them from a gallery from shared code
Setup for iOS project
Add to AppDelegate before LoadApplication
SupportMediaXFSetup.Initialize();
Add privacy to info.plist
- Privacy - Camera Usage Description
- Privacy - Photo Library Usage Description
Setup for Android project
Add to MainActivity before LoadApplication
SupportMediaXFSetup.Initialize(this);
Add permisison to manifest
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera2.full" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
Create new file_paths file in xml Resource then Add provider in application tag
<provider android:authorities="[Your application package]"
android:exported="false"
android:grantUriPermissions="true"
android:name="android.support.v4.content.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
</provider>
USAGE
Implements interface to your viewmodel to receive photos
ISupportMediaResultListener
Open Camera to Gallery by
DependencyService.Get<ISupportMedia>().IF_OpenCamera(this, new SyncPhotoOptions(), [Code Request]);
Configuration output
public class SyncPhotoOptions
{
public int Width { set; get; }
public int Height { set; get; }
public float Quality { set; get; }
public SyncPhotoOptions()
{
Width = 1280;
Height = 960;
Quality = 0.8f;
}
}
Dependencies
-
.NETStandard 2.0
- Xamarin.Forms (>= 3.2.0.871581)
-
MonoAndroid 8.1
- No dependencies.
-
Xamarin.iOS 1.0
- No dependencies.
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version History
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 519 | 10/23/2018 |