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 request = OneTimeWorkRequestBuilder<YourWorker>() | |
// OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST, which causes the job to run as an ordinary work request | |
// OutOfQuotaPolicy.DROP_WORK_REQUEST, which causes the request to cancel if there is not sufficient quota. | |
.setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST) | |
.build() | |
WorkManager.getInstance(context).enqueue(request) |
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() | |
.setRequiresCharging(true) | |
.build() | |
val work = PeriodicWorkRequestBuilder<MyWorker>( | |
// repeatInterval (the period cycle), its minimum is 15 minutes | |
1, TimeUnit.HOURS, | |
// flexInterval, its minimum is 5 minutes | |
15, TimeUnit.MINUTES) | |
.setConstraints(constraints) |
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
WorkManager.getInstance().cancelWorkById(uploadWorkRequest.id) | |
WorkManager.getInstance().cancelAllWorkByTag("sometag") |
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
WorkManager.getInstance() | |
// These three work requests run in parallel | |
.beginWith(Arrays.asList( | |
filterImageOneWorkRequest, | |
filterImageTwoWorkRequest, | |
filterImageThreeWorkRequest)) | |
// The output from the filter WorkRequests | |
// will be passed as the input of compress WorkRequest | |
.then(compressWorkRequest) | |
.then(uploadWorkRequest) |
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
// 1. Create the Constraints | |
val constraints = Constraints.Builder() | |
.setRequiredNetworkType(NetworkType.CONNECTED) | |
.build() | |
// Other supported Constraints | |
val exampleConstraints = Constraints.Builder() | |
.setRequiresBatteryNotLow(true) | |
.setRequiredNetworkType(NetworkType.CONNECTED) | |
.setRequiresCharging(true) |
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
class UploadWorker(appContext: Context, workerParams: WorkerParameters) | |
: Worker(appContext, workerParams) { | |
override fun doWork(): Result { | |
try { | |
// Get the input, where this inputData is set when building the WorkRequest | |
val imageUriInput = inputData.getString(Constants.KEY_IMAGE_URI) | |
// Do the work | |
val response = upload(imageUriInput) |
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
curl https://raw.githubusercontent.com/omnirom/android_device_brcm_rpi4/android-12.0/repo/local_manifest.xml -o local_manifest.xml |
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
/* | |
* Copyright (C) 2019 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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
xcodebuild archive ONLY_ACTIVE_ARCH=NO \ | |
-scheme YourFrameworkName \ | |
-destination "generic/platform=iOS Simulator" \ | |
-archivePath YourFrameworkName-iphonesimulator.xcarchive \ | |
-sdk iphonesimulator \ | |
SKIP_INSTALL=NO \ | |
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | |
xcodebuild archive \ | |
-scheme YourFrameworkName \ |
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
lipo -create -output Kuei.framework KueiDevice.framework/KueiDevice KueiSim.framework/KueiSim |
NewerOlder