feat: section 4 — Android battery optimization prompt

One-time prompt on first launch (Android only) directing the user to
exclude bincio-rec from battery optimization. Uses the direct
REQUEST_IGNORE_BATTERY_OPTIMIZATIONS system dialog with a fallback to
the general settings page for OEMs that block the direct intent.
Dismissal persisted in AsyncStorage so prompt never repeats.
This commit is contained in:
Davide Scaini
2026-06-03 09:09:51 +02:00
parent 5f12b2857d
commit 765efe288e
3 changed files with 39 additions and 2 deletions
+2
View File
@@ -4,6 +4,7 @@ import * as Notifications from 'expo-notifications';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { AppNavigator } from './src/navigation/AppNavigator';
import { requestNotificationPermissions } from './src/services/gps';
import { promptBatteryOptimizationIfNeeded } from './src/services/batteryOptimization';
// Show notifications even when the app is in the foreground (iOS suppresses by default)
Notifications.setNotificationHandler({
@@ -18,6 +19,7 @@ Notifications.setNotificationHandler({
export default function App() {
useEffect(() => {
requestNotificationPermissions();
promptBatteryOptimizationIfNeeded();
}, []);
return (