Fix battery prompt #160
@ -13,7 +13,6 @@
|
|||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
|
|
||||||
|
|
||||||
<uses-feature android:name="android.hardware.location.gps" />
|
<uses-feature android:name="android.hardware.location.gps" />
|
||||||
|
|
||||||
|
@ -107,27 +107,18 @@ public class MapUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void BatteryOptimizationsExceptionCheck(Context context) {
|
public static void BatteryOptimizationsExceptionCheck(Context context) {
|
||||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
|
||||||
if (!pm.isIgnoringBatteryOptimizations(context.getPackageName())) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(R.string.batter_exclusions_title);
|
builder.setTitle(R.string.batter_exclusions_title);
|
||||||
builder.setMessage(R.string.batter_exclusions_message)
|
builder.setMessage(R.string.batter_exclusions_message)
|
||||||
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.ok, (dialog, id) -> {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
Intent intentBatteryUsage = new Intent(Intent.ACTION_POWER_USAGE_SUMMARY);
|
||||||
Intent intent = new Intent();
|
context.startActivity(intentBatteryUsage);
|
||||||
intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
|
||||||
intent.setData(Uri.parse("package:" + getApplicationContext().getPackageName()));
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
|
.setNegativeButton(R.string.cancel, (dialog, id) -> {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
// User cancelled the dialog
|
// User cancelled the dialog
|
||||||
}
|
|
||||||
}).show();
|
}).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@
|
|||||||
<string name="available_now">Dostępny teraz</string>
|
<string name="available_now">Dostępny teraz</string>
|
||||||
<string name="profile_activity_title">Profil użytkownika</string>
|
<string name="profile_activity_title">Profil użytkownika</string>
|
||||||
<string name="batter_exclusions_title">Uwaga</string>
|
<string name="batter_exclusions_title">Uwaga</string>
|
||||||
<string name="batter_exclusions_message">Aby aplikacja była w pełni funkcjonalna, dodaj FMT do wyjątku w oszczędzaniu baterii</string>
|
<string name="batter_exclusions_message">Aby aplikacja była w pełni funkcjonalna, dodaj FMT do wyjątków w oszczędzaniu baterii. Po wciśnięciu przycisku "ok" zostaniesz przeniesiony do opcji zarządzania baterią. W panelu "optymalizacja użycia baterii" upewnij się, że opcja optymalizacji jest wyłączona.</string>
|
||||||
|
|
||||||
<string name="never_logged_in">Nigdy</string>
|
<string name="never_logged_in">Nigdy</string>
|
||||||
|
|
||||||
|
@ -456,7 +456,7 @@
|
|||||||
<string name="user_status_label" translatable="false">Status</string>
|
<string name="user_status_label" translatable="false">Status</string>
|
||||||
<string name="available_now">Available now</string>
|
<string name="available_now">Available now</string>
|
||||||
<string name="last_sign">Last seen</string>
|
<string name="last_sign">Last seen</string>
|
||||||
<string name="batter_exclusions_message">To make app fully functional, add FMT to battery saving exclusions</string>
|
<string name="batter_exclusions_message">To make app fully functional, add FMT to battery saving exclusions. You can change battery options in "Optimise battery usage". Unfortunately, you have to do it manually. Click "ok" to open battery settings and make sure that the application is not optimised.</string>
|
||||||
<string name="batter_exclusions_title">Please note</string>
|
<string name="batter_exclusions_title">Please note</string>
|
||||||
<string name="never_logged_in">Never</string>
|
<string name="never_logged_in">Never</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user