Skip to content

Commit 46d8a36

Browse files
authored
Merge pull request #97 from Grait-Interaction/add-android-ringtone
Adds ability to set android ring tone on success/error
2 parents 9ddf916 + 2a62d85 commit 46d8a36

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,13 @@ Returns a promise with the string ID of the upload. Will reject if there is a c
155155
|`parameters`|object|Optional||Additional form fields to include in the HTTP request. Only used when `type: 'multipart`||
156156
|`notification`|Notification object (see below)|Optional||Android only. |`{ enabled: true, onProgressTitle: "Uploading...", autoClear: true }`|
157157

158-
### Notification Object
158+
### Notification Object (Android Only)
159159
|Name|Type|Required|Description|Example|
160160
|---|---|---|---|---|
161161
|`enabled`|boolean|Optional|Enable or diasable notifications|`{ enabled: true }`|
162162
|`autoClear`|boolean|Optional|Autoclear notification on complete|`{ autoclear: true }`|
163163
|`notificationChannel`|string|Optional|Sets android notificaion channel|`{ notificationChannel: "My-Upload-Service" }`|
164+
|`enableRingTone`|boolean|Optional|Sets whether or not to enable the notification sound when the upload gets completed with success or error|`{ enableRingTone: true }`|
164165
|`onProgressTitle`|string|Optional|Sets notification progress title|`{ onProgressTitle: "Uploading" }`|
165166
|`onProgressMessage`|string|Optional|Sets notification progress message|`{ onProgressMessage: "Uploading new video" }`|
166167
|`onCompleteTitle`|string|Optional|Sets notification complete title|`{ onCompleteTitle: "Upload finished" }`|

android/src/main/java/com/vydia/UploaderModule.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ public void onCancelled(Context context, UploadInfo uploadInfo) {
222222
notificationConfig.getCompleted().autoClear = true;
223223
}
224224

225+
if (notification.hasKey("enableRingTone") && notification.getBoolean("enableRingTone")){
226+
notificationConfig.setRingToneEnabled(true);
227+
}
228+
225229
if (notification.hasKey("onCompleteTitle")) {
226230
notificationConfig.getCompleted().title = notification.getString("onCompleteTitle");
227231
}

0 commit comments

Comments
 (0)