Skip to content

Commit

Permalink
Let modern SSL work on old versions of Android
Browse files Browse the repository at this point in the history
  • Loading branch information
justdave committed May 20, 2024
1 parent a1cfd00 commit dc37bd3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ dependencies {
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.google.android.gms:play-services-safetynet:18.0.1'
implementation 'com.google.android.gms:play-services-basement:18.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package net.justdave.nwsweatheralertswidget

import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.NavController
import androidx.navigation.Navigation
import androidx.navigation.ui.NavigationUI
import com.google.android.gms.common.GoogleApiAvailability
import com.google.android.gms.security.ProviderInstaller


class MainActivity : AppCompatActivity() {
Expand All @@ -13,12 +16,25 @@ class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
upgradeSecurityProvider()
setContentView(R.layout.main_activity)
setSupportActionBar(findViewById(R.id.my_toolbar))
supportActionBar?.setDisplayHomeAsUpEnabled(true)
//supportActionBar?.setLogo(R.mipmap.app_icon)
}

private fun upgradeSecurityProvider() {
ProviderInstaller.installIfNeededAsync(this, object :
ProviderInstaller.ProviderInstallListener {
override fun onProviderInstalled() {
}

override fun onProviderInstallFailed(errorCode: Int, recoveryIntent: Intent?) {
GoogleApiAvailability.getInstance()
.showErrorNotification(this@MainActivity, errorCode)
}
})
}

override fun onSupportNavigateUp(): Boolean {
return navController.navigateUp()
Expand Down

0 comments on commit dc37bd3

Please sign in to comment.