Class AndroidInterop
Interface for the native Android plugin.
public static class AndroidInterop
- Inheritance
-
objectAndroidInterop
Methods
CreateInstance(Callbacks)
Gets an instance of the native interface.
public static AndroidJavaObject CreateInstance(AndroidInterop.Callbacks callbacks)
Parameters
callbacksAndroidInterop.Callbacks
Returns
- AndroidJavaObject
A new instance of the native interface.
Remarks
This method should generally be called only once during the application's lifetime,
as the native object is supposed to act like a singleton. If you create a new instance
of the native object while another one is active, all unfulfilled callbacks meant for
the existing instance will be forwarded to the new instance's callbacks instead.
The returned AndroidJavaObject should be disposed when no longer needed.
Exceptions
- PlatformNotSupportedException
Thrown if this method is called on a runtime other than Android.
GetFileURI(AndroidJavaObject, string, string)
Creates a shareable android.net.Uri from a filepath under the given
FileProvider authority's scope.
public static AndroidJavaObject? GetFileURI(AndroidJavaObject native, string path, string authority)
Parameters
nativeAndroidJavaObjectThe native plugin instance.
pathstringThe filepath.
authoritystringThe
FileProviderauthority whichpathis under.
Returns
- AndroidJavaObject?
A shareable
android.net.Uriobject if successful; null otherwise.
Remarks
The returned AndroidJavaObject should be disposed when no longer needed.
Exceptions
- PlatformNotSupportedException
Thrown if this method is called on a runtime other than Android.
ShareText(AndroidJavaObject, int, string, string?)
Shares text data using ChooserActivity.
public static bool ShareText(AndroidJavaObject native, int id, string text, string? title)
Parameters
nativeAndroidJavaObjectThe native plugin instance.
idintThe ID of this event, to be returned in OnTargetChosen.
textstringThe text to share.
titlestringOptional title for the sharesheet.
Returns
Exceptions
- PlatformNotSupportedException
Thrown if this method is called on a runtime other than Android.
ShareURI(AndroidJavaObject, int, AndroidJavaObject, string, string?, string?)
Shares data sourced from a URI using ChooserActivity.
public static bool ShareURI(AndroidJavaObject native, int id, AndroidJavaObject uri, string type, string? text, string? title)
Parameters
nativeAndroidJavaObjectThe native plugin instance.
idintThe ID of this event, to be returned in OnTargetChosen.
uriAndroidJavaObjectThe
android.net.Uriobject to share.typestringThe MIME type of the content being shared through the
uri.textstringOptional additional text to share.
titlestringOptional title for the sharesheet.
Returns
Exceptions
- PlatformNotSupportedException
Thrown if this method is called on a runtime other than Android.
ShareURIs(AndroidJavaObject, int, AndroidJavaObject[], string, string?, string?)
Shares multipart data sourced from URIs using ChooserActivity.
public static bool ShareURIs(AndroidJavaObject native, int id, AndroidJavaObject[] uris, string type, string? text, string? title)
Parameters
nativeAndroidJavaObjectThe native plugin instance.
idintThe ID of this event, to be returned in OnTargetChosen.
urisAndroidJavaObject[]The array of
android.net.Uriobjects to share.typestringThe MIME type of the contents being shared through the
uris.textstringOptional additional text to share.
titlestringOptional title for the sharesheet.
Returns
Exceptions
- PlatformNotSupportedException
Thrown if this method is called on a runtime other than Android.