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
String bucketName = environment.getRequiredProperty("FIREBASE_BUCKET_NAME"); | |
String projectId = environment.getRequiredProperty("FIREBASE_PROJECT_ID"); | |
FileInputStream serviceAccount = | |
new FileInputStream("/home/user/Downloads/service-account-file.json"); | |
this.storageOptions = StorageOptions.newBuilder() | |
.setProjectId(projectId) | |
.setCredentials(GoogleCredentials.fromStream(serviceAccount)).build(); |
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
{ | |
"type": "", | |
"project_id": "", | |
"private_key_id": "", | |
"private_key": "", | |
"client_email": "", | |
"client_id": "", | |
"auth_uri": "", | |
"token_uri": "", | |
"auth_provider_x509_cert_url": "", |
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
package com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.model | |
import androidx.room.Entity | |
import androidx.room.PrimaryKey | |
import com.google.gson.annotations.Expose | |
import com.google.gson.annotations.SerializedName | |
@Entity | |
data class Person( | |
@Expose(serialize = false) |
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
package com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.model | |
import androidx.room.Entity | |
import androidx.room.PrimaryKey | |
import com.google.gson.annotations.Expose | |
import com.google.gson.annotations.SerializedName | |
@Entity | |
data class Beneficiary( | |
@Expose(serialize = false) |
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
val periodicSyncDataWork = PeriodicWorkRequest.Builder(BeneficiaryWorker::class.java, 15, TimeUnit.MINUTES) | |
.addTag(Constant.TAG_SYNC_BENEFICIARY) | |
.setConstraints(constraints) // setting a backoff on case the work needs to retry | |
.setBackoffCriteria( | |
BackoffPolicy.LINEAR, | |
PeriodicWorkRequest.MIN_BACKOFF_MILLIS, | |
TimeUnit.MILLISECONDS | |
) | |
.build() | |
getWorkManager()!!.enqueueUniquePeriodicWork( |
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
val periodicSyncDataWork = | |
PeriodicWorkRequest.Builder(PersonWorker::class.java, 15, TimeUnit.MINUTES) | |
.addTag(Constant.TAG_SYNC_PERSON) | |
.setConstraints(constraints) // setting a backoff on case the work needs to retry | |
.setBackoffCriteria( | |
BackoffPolicy.LINEAR, | |
PeriodicWorkRequest.MIN_BACKOFF_MILLIS, | |
TimeUnit.MILLISECONDS | |
).build() | |
getWorkManager()!!.enqueueUniquePeriodicWork( |
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
val constraints = Constraints.Builder() | |
.setRequiredNetworkType(NetworkType.CONNECTED) | |
.build() |
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
package com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.worker | |
import android.content.Context | |
import androidx.work.WorkerParameters | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.CommunityApp | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.db.CommunityDao | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.model.Beneficiary | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.model.Person | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.service.CommunityService | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.util.Constant |
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
package com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.worker | |
import android.content.Context | |
import androidx.work.WorkerParameters | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.CommunityApp | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.db.CommunityDao | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.model.Person | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.service.CommunityService | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.util.Constant | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.util.WorkerUtils |
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
package com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.worker | |
import android.content.Context | |
import androidx.work.Worker | |
import androidx.work.WorkerParameters | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.dependency.Injector | |
import com.ikhiloyaimokhai.dependentworkmanagerperiodictask_kotlin.util.AppExecutor | |
import retrofit2.Call | |
import retrofit2.Response | |
import timber.log.Timber |