-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from apivideo/feature/android_service
Feature/android service
- Loading branch information
Showing
26 changed files
with
1,615 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,6 @@ git_push.sh | |
.openapi-generator-ignore | ||
build.sbt | ||
post-generate.sh | ||
|
||
# Android files | ||
/local.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
example/src/main/java/video/api/client/example/CustomUploaderService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package video.api.client.example | ||
|
||
import android.app.Notification | ||
import androidx.core.app.NotificationCompat | ||
import video.api.client.api.models.Video | ||
import video.api.client.api.services.UploadService | ||
|
||
class CustomUploaderService : UploadService( | ||
notificationId = DEFAULT_NOTIFICATION_ID, | ||
channelId = DEFAULT_NOTIFICATION_CHANNEL_ID, | ||
channelNameResourceId = R.string.channel_name, | ||
) { | ||
companion object { | ||
const val DEFAULT_NOTIFICATION_CHANNEL_ID = | ||
"video.api.client.example.CustomUploaderService" | ||
const val DEFAULT_NOTIFICATION_ID = 3535 // Unique ID for the notification | ||
} | ||
|
||
/** | ||
* You can override each of [UploadService] notification methods to customize notifications. | ||
*/ | ||
override fun onUploadSuccessNotification(video: Video): Notification { | ||
// Return your custom the notification | ||
return NotificationCompat.Builder(this, channelId) | ||
.setStyle(notificationIconResourceId, notificationColorResourceId) | ||
.setContentTitle(getString(R.string.upload_success_notification_text)) | ||
.build() | ||
} | ||
} |
Oops, something went wrong.