mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-03-29 19:23:30 -04:00
@@ -17,8 +17,8 @@ android {
|
||||
applicationId "com.geeksville.mesh"
|
||||
minSdkVersion 21 // The oldest emulator image I have tried is 22 (though 21 probably works)
|
||||
targetSdkVersion 29
|
||||
versionCode 10776 // format is Mmmss (where M is 1+the numeric major number
|
||||
versionName "0.7.76"
|
||||
versionCode 10777 // format is Mmmss (where M is 1+the numeric major number
|
||||
versionName "0.7.77"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
@@ -92,10 +92,10 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.core:core-ktx:1.3.0'
|
||||
implementation "androidx.fragment:fragment-ktx:1.2.4"
|
||||
implementation 'androidx.fragment:fragment-ktx:1.2.5'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta6'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'androidx.viewpager2:viewpager2:1.0.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
|
||||
|
||||
@@ -353,7 +353,7 @@ class MeshService : Service(), Logging {
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun createNotificationChannel(): String {
|
||||
val channelId = "my_service"
|
||||
val channelName = "My Background Service"
|
||||
val channelName = getString(R.string.meshtastic_service_notifications)
|
||||
val chan = NotificationChannel(
|
||||
channelId,
|
||||
channelName, NotificationManager.IMPORTANCE_HIGH
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.companion.CompanionDeviceManager
|
||||
import android.content.*
|
||||
import android.hardware.usb.UsbDevice
|
||||
import android.hardware.usb.UsbManager
|
||||
import android.location.LocationManager
|
||||
import android.os.Bundle
|
||||
import android.os.ParcelUuid
|
||||
import android.view.LayoutInflater
|
||||
@@ -751,6 +752,15 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
scanModel.stopScan()
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the user _turned on_ the system setting for current location access.
|
||||
*/
|
||||
private fun isLocationEnabled(): Boolean {
|
||||
val locManager =
|
||||
requireContext().getSystemService(Context.LOCATION_SERVICE) as LocationManager
|
||||
return locManager.isLocationEnabled
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
if (!hasCompanionDeviceApi)
|
||||
@@ -758,12 +768,21 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
||||
|
||||
// Keep reminding user BLE is still off
|
||||
val hasUSB = activity?.let { SerialInterface.findDrivers(it).isNotEmpty() } ?: true
|
||||
if (scanModel.bluetoothAdapter?.isEnabled != true && !hasUSB) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
R.string.error_bluetooth,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
if (!hasUSB) {
|
||||
// Warn user if BLE is disabled
|
||||
if (scanModel.bluetoothAdapter?.isEnabled != true) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
R.string.error_bluetooth,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
} else if (!isLocationEnabled()) {
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
getString(R.string.location_disabled_warning),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,4 +68,6 @@
|
||||
<string name="modem_config_long">Long range (but slower)</string>
|
||||
<string name="modem_config_very_long">Very long range (but slow)</string>
|
||||
<string name="modem_config_unrecognized">UNRECOGNIZED</string>
|
||||
<string name="meshtastic_service_notifications">Meshtastic Service Notifications</string>
|
||||
<string name="location_disabled_warning">You must turn on location services in Android Settings</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user