mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
commit
75be43b3c5
7 changed files with 83 additions and 60 deletions
BIN
app/src/main/ic_launcher-114x114.png
Normal file
BIN
app/src/main/ic_launcher-114x114.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
|
|
@ -334,26 +334,20 @@ class MainActivity : AppCompatActivity(), Logging,
|
|||
private fun askToRate() {
|
||||
exceptionReporter { // Got one IllegalArgumentException from inside this lib, but we don't want to crash our app because of bugs in this optional feature
|
||||
|
||||
AppRate.with(this)
|
||||
val hasGooglePlay = GoogleApiAvailability.getInstance()
|
||||
.isGooglePlayServicesAvailable(this) != ConnectionResult.SERVICE_MISSING
|
||||
|
||||
val rater = AppRate.with(this)
|
||||
.setInstallDays(10.toByte()) // default is 10, 0 means install day, 10 means app is launched 10 or more days later than installation
|
||||
.setLaunchTimes(10.toByte()) // default is 10, 3 means app is launched 3 or more times
|
||||
.setRemindInterval(1.toByte()) // default is 1, 1 means app is launched 1 or more days after neutral button clicked
|
||||
.setRemindLaunchesNumber(1.toByte()) // default is 0, 1 means app is launched 1 or more times after neutral button clicked
|
||||
.monitor() // Monitors the app launch times
|
||||
.setStoreType(if (hasGooglePlay) StoreType.GOOGLEPLAY else StoreType.AMAZON)
|
||||
|
||||
rater.monitor() // Monitors the app launch times
|
||||
|
||||
// Only ask to rate if the user has a suitable store
|
||||
if (AppRate.with(this).storeType == StoreType.GOOGLEPLAY) { // Checks that current app store type from library options is StoreType.GOOGLEPLAY
|
||||
if (GoogleApiAvailability.getInstance()
|
||||
.isGooglePlayServicesAvailable(this) != ConnectionResult.SERVICE_MISSING
|
||||
) { // Checks that Google Play is available
|
||||
AppRate.showRateDialogIfMeetsConditions(this) // Shows the Rate Dialog when conditions are met
|
||||
|
||||
// Force the dialog - for testing
|
||||
// AppRate.with(this).showRateDialog(this)
|
||||
}
|
||||
} else {
|
||||
AppRate.showRateDialogIfMeetsConditions(this); // Shows the Rate Dialog when conditions are met
|
||||
}
|
||||
AppRate.showRateDialogIfMeetsConditions(this); // Shows the Rate Dialog when conditions are met
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import com.geeksville.analytics.DataPair
|
|||
import com.geeksville.android.GeeksvilleApplication
|
||||
import com.geeksville.android.Logging
|
||||
import com.geeksville.android.ServiceClient
|
||||
import com.geeksville.android.isGooglePlayAvailable
|
||||
import com.geeksville.concurrent.handledLaunch
|
||||
import com.geeksville.mesh.*
|
||||
import com.geeksville.mesh.MeshProtos.MeshPacket
|
||||
|
|
@ -242,7 +243,8 @@ class MeshService : Service(), Logging {
|
|||
@SuppressLint("MissingPermission")
|
||||
@UiThread
|
||||
private fun startLocationRequests() {
|
||||
if (fusedLocationClient == null) {
|
||||
// FIXME - currently we don't support location reading without google play
|
||||
if (fusedLocationClient == null && isGooglePlayAvailable(this)) {
|
||||
GeeksvilleApplication.analytics.track("location_start") // Figure out how many users needed to use the phone GPS
|
||||
|
||||
val request = LocationRequest.create().apply {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import androidx.lifecycle.Observer
|
|||
import com.geeksville.android.GeeksvilleApplication
|
||||
import com.geeksville.android.Logging
|
||||
import com.geeksville.android.hideKeyboard
|
||||
import com.geeksville.android.isGooglePlayAvailable
|
||||
import com.geeksville.concurrent.handledLaunch
|
||||
import com.geeksville.mesh.MainActivity
|
||||
import com.geeksville.mesh.R
|
||||
|
|
@ -687,8 +688,9 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
// To skip filtering based on name and supported feature flags (UUIDs),
|
||||
// don't include calls to setNamePattern() and addServiceUuid(),
|
||||
// respectively. This example uses Bluetooth.
|
||||
// We only look for Mesh (rather than the full name) because NRF52 uses a very short name
|
||||
val deviceFilter: BluetoothDeviceFilter = BluetoothDeviceFilter.Builder()
|
||||
.setNamePattern(Pattern.compile("Meshtastic_.*"))
|
||||
.setNamePattern(Pattern.compile("Mesh.*"))
|
||||
// .addServiceUuid(ParcelUuid(RadioInterfaceService.BTM_SERVICE_UUID), null)
|
||||
.build()
|
||||
|
||||
|
|
@ -768,45 +770,48 @@ class SettingsFragment : ScreenFragment("Settings"), Logging {
|
|||
* If the user has not turned on location access throw up a toast warning
|
||||
*/
|
||||
private fun checkLocationEnabled() {
|
||||
// We do this painful process because LocationManager.isEnabled is only SDK28 or latet
|
||||
val builder = LocationSettingsRequest.Builder()
|
||||
builder.setNeedBle(true)
|
||||
// If they don't have google play FIXME for now we don't check for location access
|
||||
if (isGooglePlayAvailable(requireContext())) {
|
||||
// We do this painful process because LocationManager.isEnabled is only SDK28 or latet
|
||||
val builder = LocationSettingsRequest.Builder()
|
||||
builder.setNeedBle(true)
|
||||
|
||||
val request = LocationRequest.create().apply {
|
||||
priority = LocationRequest.PRIORITY_HIGH_ACCURACY
|
||||
}
|
||||
builder.addLocationRequest(request) // Make sure we are granted high accuracy permission
|
||||
val request = LocationRequest.create().apply {
|
||||
priority = LocationRequest.PRIORITY_HIGH_ACCURACY
|
||||
}
|
||||
builder.addLocationRequest(request) // Make sure we are granted high accuracy permission
|
||||
|
||||
val locationSettingsResponse = LocationServices.getSettingsClient(requireActivity())
|
||||
.checkLocationSettings(builder.build())
|
||||
val locationSettingsResponse = LocationServices.getSettingsClient(requireActivity())
|
||||
.checkLocationSettings(builder.build())
|
||||
|
||||
locationSettingsResponse.addOnSuccessListener {
|
||||
debug("We have location access")
|
||||
}
|
||||
locationSettingsResponse.addOnSuccessListener {
|
||||
debug("We have location access")
|
||||
}
|
||||
|
||||
locationSettingsResponse.addOnFailureListener { exception ->
|
||||
errormsg("Failed to get location access")
|
||||
// We always show the toast regardless of what type of exception we receive. Because even non
|
||||
// resolvable api exceptions mean user still needs to fix something.
|
||||
|
||||
///if (exception is ResolvableApiException) {
|
||||
locationSettingsResponse.addOnFailureListener { exception ->
|
||||
errormsg("Failed to get location access")
|
||||
// We always show the toast regardless of what type of exception we receive. Because even non
|
||||
// resolvable api exceptions mean user still needs to fix something.
|
||||
|
||||
// Location settings are not satisfied, but this can be fixed
|
||||
// by showing the user a dialog.
|
||||
///if (exception is ResolvableApiException) {
|
||||
|
||||
// Show the dialog by calling startResolutionForResult(),
|
||||
// and check the result in onActivityResult().
|
||||
// exception.startResolutionForResult(this@MainActivity, REQUEST_CHECK_SETTINGS)
|
||||
// Location settings are not satisfied, but this can be fixed
|
||||
// by showing the user a dialog.
|
||||
|
||||
// For now just punt and show a dialog
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
getString(R.string.location_disabled_warning),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
// Show the dialog by calling startResolutionForResult(),
|
||||
// and check the result in onActivityResult().
|
||||
// exception.startResolutionForResult(this@MainActivity, REQUEST_CHECK_SETTINGS)
|
||||
|
||||
//} else
|
||||
// Exceptions.report(exception)
|
||||
// For now just punt and show a dialog
|
||||
Toast.makeText(
|
||||
requireContext(),
|
||||
getString(R.string.location_disabled_warning),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
|
||||
//} else
|
||||
// Exceptions.report(exception)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,40 +3,40 @@
|
|||
<string name="app_name" translatable="false">Mesh网络</string>
|
||||
<string name="action_settings">设置</string>
|
||||
<string name="channel_name">频道名称</string>
|
||||
<string name="channel_options">频道选项</string>
|
||||
<string name="channel_options">频道设置</string>
|
||||
<string name="share_button">分享</string>
|
||||
<string name="qr_code">QR码</string>
|
||||
<string name="unset">未设置</string>
|
||||
<string name="connection_status">连接状态</string>
|
||||
<string name="application_icon">应用图标</string>
|
||||
<string name="unknown_username">未知用户名</string>
|
||||
<string name="unknown_username">未知用户</string>
|
||||
<string name="user_avatar">用户头像</string>
|
||||
<string name="sample_message">在吗?我找到了快递,它就在一只大老虎旁边,我好害怕😨!</string>
|
||||
<string name="send_text">在此发送信息</string>
|
||||
<string name="warning_not_paired">Mesh设备未与此手机配对,请配对设备并设置好您的用户名.\n\n此开源应用程序正在进行alpha测试,如果您发现问题,请在我们的网站中发布.\n\n更多信息,请访问此网页 - www.meshtastic.org.</string>
|
||||
<string name="warning_not_paired">设备未配对,请配对设备并设置好用户名.\n\n此开源应用为测试版,若您发现任何问题可以在下面的网站中发布.\n\n更多信息,请访问此网页 - www.meshtastic.org.</string>
|
||||
<string name="username_unset">用户名未设置</string>
|
||||
<string name="your_name">用户名</string>
|
||||
<string name="analytics_okay">匿名使用情况统计信息和崩溃报告.</string>
|
||||
<string name="analytics_okay">匿名上传崩溃报告.</string>
|
||||
<string name="looking_for_meshtastic_devices">Mesh设备扫描中...</string>
|
||||
<string name="test__devname1" translatable="false">Meshtastic_ac23</string>
|
||||
<string name="test_devname2" translatable="false">Meshtastic_1267</string>
|
||||
<string name="requires_bluetooth">此应用程序需要蓝牙权限.请在Android设置中授予权限.</string>
|
||||
<string name="error_bluetooth">错误:此应用需要蓝牙</string>
|
||||
<string name="error_bluetooth">未开启蓝牙</string>
|
||||
<string name="starting_pairing">开始配对</string>
|
||||
<string name="pairing_failed">配对失败</string>
|
||||
<string name="url_for_join">用于连接Mesh网络的URL</string>
|
||||
<string name="accept">接受</string>
|
||||
<string name="cancel">取消</string>
|
||||
<string name="change_channel">修改频道</string>
|
||||
<string name="are_you_sure_channel">您确定要修改通信频道吗?这将会使你与其他节点断开通信. </string>
|
||||
<string name="are_you_sure_channel">您确定要修改通信频道?这将会使你与其他节点断开通信.</string>
|
||||
<string name="new_channel_rcvd">收到新的频道URL</string>
|
||||
<string name="do_you_want_switch">您是否要切换到\'%s\'频道?</string>
|
||||
<string name="map_not_allowed">您已禁用了分析功能,但是我们的地图提供商(mapbox)要求对其进行分析\'free\' 因此,这将会关闭地图视图.\n\n
|
||||
如果您想看地图, 你将\'需要在设置中打开分析功能(此外,暂时可能需要强制重新启动应用)\n\n
|
||||
如果您想切换到其他地图提供商,请在meshtastic.discourse.group中发布</string>
|
||||
<string name="map_not_allowed">您已禁用了分析功能,但是我们的地图提供商(mapbox)要求对其进行分析\'free\' 因此,这将会关闭地图视图.\n\n如果您想看地图, 你将\'需要在“设置”中打开匿名统计(同时你需要重启应用)\n\n如果您想切换到其他地图类形,请在meshtastic.discourse.group中发布</string>
|
||||
<string name="permission_missing">缺少必需的权限,Mesh网络将无法正常工作,请在应用程序设置中启用.</string>
|
||||
<string name="radio_sleeping">LoRa模块正处于休眠之中,您暂时无法更改频道</string>
|
||||
<string name="radio_sleeping">模块正处于休眠之中,无法更改频道</string>
|
||||
<string name="report_bug">反馈BUG</string>
|
||||
<string name="report_a_bug">反馈一个BUG</string>
|
||||
<string name="report_bug_text">您确定要报告错误吗?报告后,请发布在meshtastic.discourse.group中,以便我们将您的报告与您找到的内容进行匹配.</string>
|
||||
<string name="report_bug_text">您确定要报告错误吗?报告后,请发布在网站中,以便将您的报告与您找到的内容进行匹配.</string>
|
||||
<string name="report">报告</string>
|
||||
<string name="select_radio">选择LoRa模块</string>
|
||||
<string name="current_pair">您目前已与LoRa模块配对%s</string>
|
||||
|
|
@ -45,5 +45,27 @@
|
|||
<string name="please_pair">请在Android设置中配对设备.</string>
|
||||
<string name="pairing_completed">配对成功,服务以启动</string>
|
||||
<string name="pairing_failed_try_again">配对失败,请再次选择</string>
|
||||
<string name="location_disabled">位置访问已禁用,将无法为Mesh设备提供位置.</string>
|
||||
<string name="location_disabled">位置访问已被禁用,这将无法为设备提供位置服务.</string>
|
||||
<string name="share">分享</string>
|
||||
<string name="disconnected">已断开连接</string>
|
||||
<string name="device_sleeping">设备休眠中</string>
|
||||
<string name="connected_count">连接状态:%s到%s设备在线</string>
|
||||
<string name="list_of_nodes">节点列表</string>
|
||||
<string name="update_firmware">更新设备固件</string>
|
||||
<string name="connected">已连接设备</string>
|
||||
<string name="connected_to">手机已连接到 (%s)</string>
|
||||
<string name="not_connected">未连接,请选择设备</string>
|
||||
<string name="connected_sleeping">已连接,设备休眠中</string>
|
||||
<string name="update_to">更新到%s</string>
|
||||
<string name="app_too_old">应用程序版本过旧</string>
|
||||
<string name="must_update">您需要在Google Play商店(或Github)上更新此应用程序,现在您无法与这台Mesh设备通信.</string>
|
||||
<string name="none">无选择(默认)</string>
|
||||
<string name="modem_config_short">短距离(传输快速)</string>
|
||||
<string name="modem_config_medium">中等范围(传输较快)</string>
|
||||
<string name="modem_config_long">较大范围(传输较慢)</string>
|
||||
<string name="modem_config_very_long">超长距离(传输缓慢)</string>
|
||||
<string name="modem_config_unrecognized">无法识别</string>
|
||||
<string name="meshtastic_service_notifications">Mesh服务通知</string>
|
||||
<string name="location_disabled_warning">您需要在设置中启用位置服务</string>
|
||||
<string name="about">关于</string>
|
||||
</resources>
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit ab381a83f5380358fa8412a58635e390c3729192
|
||||
Subproject commit cfe31d66e4de324fa91a2978a76ffcfba5e01085
|
||||
BIN
images/amazon-badge.png
Normal file
BIN
images/amazon-badge.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
Loading…
Add table
Add a link
Reference in a new issue