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
private fun createOkHttpClient(): OkHttpClient { | |
return OkHttp.Builder().apply { | |
createSocketFactoryForKitKatOrLollipop()?.let { socketFactory -> | |
sslSocketFactory(socketFactory) | |
} | |
} | |
} | |
private fun createSocketFactoryForKitKatOrLollipop(): SSLSocketFactory? { | |
/** |
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
/** | |
* Typical error: | |
* | |
* X509Util: Failed to validate the certificate chain, error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. | |
* MyWebViewClient: onReceivedSslError: handler = [Handler (com.android.webview.chromium.WebViewContentsClientAdapter$3) {9d87c030}], error = [primary error: 3 certificate: Issued to: | |
* CN=*.bootstrapcdn.com,OU=Domain Control Validated; | |
* Issued by: CN=Sectigo RSA Domain Validation Secure Server CA,O=Sectigo Limited,L=Salford,ST=Greater Manchester,C=GB; | |
* on URL: https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css] | |
*/ |
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.netgem.diamondcore.base.manager | |
import android.annotation.TargetApi | |
import android.content.BroadcastReceiver | |
import android.content.Context | |
import android.content.Intent | |
import android.content.IntentFilter | |
import android.net.ConnectivityManager | |
import android.net.Network | |
import android.net.NetworkCapabilities |
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
@Database(entities = [Foo::class], version = 1, exportSchema = false) | |
abstract class AppDatabase : RoomDatabase() { | |
abstract fun fooDao(): FooDao | |
companion object { | |
fun buildDatabase(context: Context) = | |
Room | |
.databaseBuilder(context.applicationContext, AppDatabase::class.java, "AppDatabase.db") | |
.build() | |
} |