JavaScript is disabled on your browser.
All Implemented Interfaces:
ShareService
Create the file /src/android/res/xml/file_provider_paths.xml
with
the following content that allows access to the external storage:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external_files" path="." />
</paths>
Add a provider
to the AndroidManifest:
<manifest package="${application.package.name}" ...>
<application ...>
...
<activity android:name="com.gluonhq.helloandroid.PermissionRequestActivity" />
<provider
android:name="com.gluonhq.helloandroid.FileProvider"
android:authorities="${application.package.name}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
</application>
</manifest>
Constructor Summary
Constructors
Method Summary
All Methods Instance Methods Concrete Methods
void
Allows sharing a message, selecting from the suitable apps available in the
user device.
void
Allows sharing a file, selecting from the suitable apps available in the
user device.
void
Allows sharing a message, selecting from the suitable apps available in the
user device.
void
Allows sharing a file, selecting from the suitable apps available in the
user device.
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
Constructor Details
AndroidShareService
public AndroidShareService ()
Method Details
share
public void share (String contentText)
Allows sharing a message, selecting from the suitable apps available in the
user device.
Specified by:
share
in interface ShareService
Parameters:
contentText
- A string with the content to be shared
share
Allows sharing a message, selecting from the suitable apps available in the
user device.
Intended to add a subject to the message, for instance, when it is shared
with an email application.
Specified by:
share
in interface ShareService
Parameters:
subject
- A string with the subject of the message
contentText
- A string with the content to be shared
share
Allows sharing a file, selecting from the suitable apps available in the
user device.
Note: On Android, the file has to be located in a public folder (see
StorageService#getPublicStorage), or sharing it won't be allowed.
Specified by:
share
in interface ShareService
Parameters:
type
- On Android only, the MIME type of the file. It can be
'∗/∗', but not empty. On iOS it can be null. Usual types are:
application/xml
application/zip
application/pdf
text/css
text/html
text/csv
text/plain
image/png
image/jpeg
image/gif
image/*
file
- A valid file to be shared.
share
Allows sharing a file, selecting from the suitable apps available in the
user device. A message will be also added.
Note: On Android, the file has to be located in a public folder (see
StorageService#getPublicStorage), or sharing it won't be allowed.
Specified by:
share
in interface ShareService
Parameters:
subject
- A string with the subject of the message
contentText
- A string with the content to be shared
type
- On Android only, the MIME type of the file. It can be
'∗/∗', but not empty. On iOS it can be null. Usual types are:
application/xml
application/zip
application/pdf
text/css
text/html
text/csv
text/plain
image/png
image/jpeg
image/gif
image/*
file
- A valid file to be shared.