5/2/pass3
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<!-- Optional: Add this permission if you want to use bluetooth telephony device like headset/earbuds (min SDK: 23) -->
|
||||
<!-- Optional: Add this permission if you want to use bluetooth telephony device like
|
||||
headset/earbuds (min SDK: 23) -->
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<!-- Optional: Add this permission if you want to save your recordings in public folders -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
<!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/> -->
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
<!-- Permissions required by the SDK -->
|
||||
@@ -32,27 +33,34 @@
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
|
||||
|
||||
<application android:label="SEFER" android:name="${applicationName}" android:icon="@mipmap/launcher_icon">
|
||||
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||
<application android:label="SEFER" android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme"/>
|
||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/api_key"/>
|
||||
<meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/api_key" />
|
||||
|
||||
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/>
|
||||
<meta-data android:name="com.android.application.versionCode" android:value="1"/>
|
||||
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="@string/default_notification_channel_id" />
|
||||
<meta-data android:name="com.android.application.versionCode" android:value="1" />
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data android:name="flutterEmbedding" android:value="2"/>
|
||||
<activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
|
||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||
<activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@@ -1,67 +1,67 @@
|
||||
import 'dart:async';
|
||||
import 'package:background_location/background_location.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
// import 'dart:async';
|
||||
// import 'package:background_location/background_location.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class LocationBackgroundController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
requestLocationPermission();
|
||||
configureBackgroundLocation();
|
||||
}
|
||||
// class LocationBackgroundController extends GetxController {
|
||||
// @override
|
||||
// void onInit() {
|
||||
// super.onInit();
|
||||
// requestLocationPermission();
|
||||
// configureBackgroundLocation();
|
||||
// }
|
||||
|
||||
Future<void> requestLocationPermission() async {
|
||||
var status = await Permission.locationAlways.status;
|
||||
if (!status.isGranted) {
|
||||
await Permission.locationAlways.request();
|
||||
}
|
||||
}
|
||||
// Future<void> requestLocationPermission() async {
|
||||
// var status = await Permission.locationAlways.status;
|
||||
// if (!status.isGranted) {
|
||||
// await Permission.locationAlways.request();
|
||||
// }
|
||||
// }
|
||||
|
||||
Future<void> configureBackgroundLocation() async {
|
||||
await BackgroundLocation.setAndroidNotification(
|
||||
title: "Background Location",
|
||||
message: "Tracking location...",
|
||||
icon: "@mipmap/ic_launcher",
|
||||
);
|
||||
// Future<void> configureBackgroundLocation() async {
|
||||
// await BackgroundLocation.setAndroidNotification(
|
||||
// title: "Background Location",
|
||||
// message: "Tracking location...",
|
||||
// icon: "@mipmap/ic_launcher",
|
||||
// );
|
||||
|
||||
BackgroundLocation.setAndroidConfiguration(1000);
|
||||
BackgroundLocation.startLocationService();
|
||||
BackgroundLocation.getLocationUpdates((location) {
|
||||
// Handle location updates here
|
||||
print("New location: ${location.latitude}, ${location.longitude}");
|
||||
});
|
||||
}
|
||||
// BackgroundLocation.setAndroidConfiguration(1000);
|
||||
// BackgroundLocation.startLocationService();
|
||||
// BackgroundLocation.getLocationUpdates((location) {
|
||||
// // Handle location updates here
|
||||
// print("New location: ${location.latitude}, ${location.longitude}");
|
||||
// });
|
||||
// }
|
||||
|
||||
startBackLocation() async {
|
||||
Timer.periodic(const Duration(seconds: 5), (timer) {
|
||||
getBackgroundLocation();
|
||||
});
|
||||
}
|
||||
// startBackLocation() async {
|
||||
// Timer.periodic(const Duration(seconds: 5), (timer) {
|
||||
// getBackgroundLocation();
|
||||
// });
|
||||
// }
|
||||
|
||||
getBackgroundLocation() async {
|
||||
var status = await Permission.locationAlways.status;
|
||||
if (status.isGranted) {
|
||||
await BackgroundLocation.startLocationService(
|
||||
distanceFilter: 20, forceAndroidLocationManager: true);
|
||||
BackgroundLocation.setAndroidConfiguration(
|
||||
Duration.microsecondsPerSecond); // Set interval to 5 seconds
|
||||
// getBackgroundLocation() async {
|
||||
// var status = await Permission.locationAlways.status;
|
||||
// if (status.isGranted) {
|
||||
// await BackgroundLocation.startLocationService(
|
||||
// distanceFilter: 20, forceAndroidLocationManager: true);
|
||||
// BackgroundLocation.setAndroidConfiguration(
|
||||
// Duration.microsecondsPerSecond); // Set interval to 5 seconds
|
||||
|
||||
BackgroundLocation.getLocationUpdates((location1) {
|
||||
print('''\n
|
||||
Latitude: ${location1.latitude.toString()}
|
||||
Longitude: ${location1.longitude.toString()}
|
||||
Altitude: ${location1.altitude.toString()}
|
||||
Accuracy: ${location1.accuracy.toString()}
|
||||
Bearing: ${location1.bearing.toString()}
|
||||
Speed: ${location1.speed.toString()}
|
||||
// BackgroundLocation.getLocationUpdates((location1) {
|
||||
// print('''\n
|
||||
// Latitude: ${location1.latitude.toString()}
|
||||
// Longitude: ${location1.longitude.toString()}
|
||||
// Altitude: ${location1.altitude.toString()}
|
||||
// Accuracy: ${location1.accuracy.toString()}
|
||||
// Bearing: ${location1.bearing.toString()}
|
||||
// Speed: ${location1.speed.toString()}
|
||||
|
||||
|
||||
''');
|
||||
});
|
||||
} else {
|
||||
await Permission.locationAlways.request();
|
||||
print('Location permission not granted');
|
||||
}
|
||||
}
|
||||
}
|
||||
// ''');
|
||||
// });
|
||||
// } else {
|
||||
// await Permission.locationAlways.request();
|
||||
// print('Location permission not granted');
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -58,14 +58,14 @@ void main() async {
|
||||
print(Get.deviceLocale!.countryCode);
|
||||
Stripe.publishableKey = AK.publishableKey;
|
||||
if (box.read(BoxName.driverID) != null) {
|
||||
Get.defaultDialog(
|
||||
title: 'Gps required',
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'ok'.tr,
|
||||
onPressed: () {
|
||||
Get.put(LocationBackgroundController());
|
||||
}));
|
||||
// Get.defaultDialog(
|
||||
// title: 'Gps required',
|
||||
// middleText: '',
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'ok'.tr,
|
||||
// onPressed: () {
|
||||
// Get.put(LocationBackgroundController());
|
||||
// }));
|
||||
}
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await Firebase.initializeApp(
|
||||
|
||||
Reference in New Issue
Block a user