diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt
index aeaee201..239d17c1 100644
--- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt
+++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/RepeaterManager.kt
@@ -5,6 +5,7 @@ import android.content.ComponentName
import android.content.DialogInterface
import android.content.Intent
import android.content.ServiceConnection
+import android.content.pm.PackageManager
import android.net.wifi.SoftApConfiguration
import android.net.wifi.p2p.WifiP2pGroup
import android.os.Build
@@ -88,7 +89,11 @@ class RepeaterManager(private val parent: TetheringFragment) : Manager(), Servic
when (binder?.service?.status) {
RepeaterService.Status.IDLE -> if (Build.VERSION.SDK_INT < 29) parent.requireContext().let { context ->
ContextCompat.startForegroundService(context, Intent(context, RepeaterService::class.java))
- } else parent.startRepeater.launch(Manifest.permission.ACCESS_FINE_LOCATION)
+ } else if (parent.requireContext().checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) ==
+ PackageManager.PERMISSION_GRANTED ||
+ parent.shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_FINE_LOCATION)) {
+ parent.startRepeater.launch(Manifest.permission.ACCESS_FINE_LOCATION)
+ } else SmartSnackbar.make(R.string.repeater_missing_location_permissions).shortToast().show()
RepeaterService.Status.ACTIVE -> binder.shutdown()
else -> { }
}
diff --git a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt
index 5631fa1e..ace3cc2b 100644
--- a/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt
+++ b/mobile/src/main/java/be/mygod/vpnhotspot/manage/TetheringFragment.kt
@@ -2,7 +2,6 @@
package be.mygod.vpnhotspot.manage
-import android.Manifest
import android.annotation.TargetApi
import android.content.*
import android.os.Build
@@ -12,7 +11,6 @@ import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
-import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.RequiresApi
import androidx.appcompat.widget.Toolbar
@@ -126,11 +124,7 @@ class TetheringFragment : Fragment(), ServiceConnection, Toolbar.OnMenuItemClick
@RequiresApi(29)
val startRepeater = registerForActivityResult(ActivityResultContracts.RequestPermission()) { granted ->
- val activity = requireActivity()
- if (granted) activity.startForegroundService(Intent(activity, RepeaterService::class.java))
- else if (!activity.shouldShowRequestPermissionRationale(Manifest.permission.ACCESS_FINE_LOCATION)) {
- Toast.makeText(activity, "Repeater requires LOCATION permission", Toast.LENGTH_SHORT).show()
- }
+ if (granted) requireActivity().startForegroundService(Intent(activity, RepeaterService::class.java))
}
@RequiresApi(26)
val startLocalOnlyHotspot = registerForActivityResult(ActivityResultContracts.RequestPermission()) {
diff --git a/mobile/src/main/res/values-zh-rCN/strings.xml b/mobile/src/main/res/values-zh-rCN/strings.xml
index 8eecc429..37095766 100644
--- a/mobile/src/main/res/values-zh-rCN/strings.xml
+++ b/mobile/src/main/res/values-zh-rCN/strings.xml
@@ -28,6 +28,7 @@
未添加服务请求
不支持此操作
服务不可用,请稍后重试
+ 无线中继需要精确位置权限
临时 WLAN 热点
使用临时热点需要打开位置服务。
diff --git a/mobile/src/main/res/values/strings.xml b/mobile/src/main/res/values/strings.xml
index 4e93ef1d..f3ce86b8 100644
--- a/mobile/src/main/res/values/strings.xml
+++ b/mobile/src/main/res/values/strings.xml
@@ -45,6 +45,8 @@
no service requests added
unsupported operation
Service unavailable. Try again later
+ Repeater requires permissions for accessing fine
+ location
Temporary Wi\u2011Fi hotspot
Temporary hotspot requires location to be turned on.