- Catalina
- Big Sur
- Monterey
- Ventura
- Sonoma
suspend fun <T> Task<T>.await(): T { | |
if (isComplete) return if (isSuccessful) result else throw exception!! | |
return suspendCoroutine { c: Continuation<T> -> | |
addOnSuccessListener { c.resume(it) } | |
addOnFailureListener { c.resumeWithException(it) } | |
} | |
} | |
fun <T> Deferred<T>.asTask(): Task<T> { | |
val source = TaskCompletionSource<T>() |
// MIT License | |
// Copyright (c) 2018 Boris Polania | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
MacBook Air (Early 2015) のSSDを960 EVOに換装しました。 MBAをNVMeのSSDに換装したという情報は日本語では少なかったのでメモ書き。 他のMacでも、High Sierra以上かつ対応するアダプタを使用すればこのgistは参考になると思います。
また、さすがにこの環境でWindowsやLinuxを動かしているという人は 検索した範囲ではまだ見つかりませんでしたね。
結論を言うと、macOSはじめWindows 10やArch Linuxでも動いていますが、注意する点がありました:
import com.google.android.gms.common.GoogleApiAvailability | |
import com.google.android.gms.tasks.Task | |
import splitties.init.appCtx | |
import kotlin.coroutines.experimental.suspendCoroutine | |
val googleApiAvailability = GoogleApiAvailability.getInstance()!! | |
inline val playServicesAvailability get() = googleApiAvailability.isGooglePlayServicesAvailable(appCtx) | |
@JvmName("awaitVoid") | |
suspend fun Task<Void>.await() = suspendCoroutine<Unit> { continuation -> |
This Gist provide the function to retrieve the local IP address of the device when connected to the wifi.
No permission is required from the user to access the information. It uses the getifaddrs method that is not directly part of the public iOS API but it's still perfectly fine to use it and allowed by Apple.
/* | |
* Copyright 2017 Piruin Panichphol | |
* | |
* 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 |
import rx.Observable; | |
import rx.subjects.PublishSubject; | |
import rx.subjects.SerializedSubject; | |
import rx.subjects.Subject; | |
/** | |
* @author <a href="mailto:jaredsburrows@gmail.com">Jared Burrows</a> | |
*/ | |
public final class RxBus { | |
private final Subject<Object, Object> bus = new SerializedSubject<>(PublishSubject.create()); |
Let's say you want to access the application shared preferences in /data/data/com.mypackage.
You could try to run adb shell
and then run-as com.mypackage
( or adb shell run-as com.mypackge ls /data/data/com.mypackage/shared_prefs
),
but on a production release app downloaded from an app store you're most likely to see:
run-as: Package 'com.mypackage' is not debuggable