5/2/pass3
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
<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" />
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
<!-- Optional: Add this permission if you want to save your recordings in public folders -->
|
<!-- 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.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_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
@@ -32,13 +33,18 @@
|
|||||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||||
|
|
||||||
|
|
||||||
<application android:label="SEFER" android:name="${applicationName}" android:icon="@mipmap/launcher_icon">
|
<application android:label="SEFER" android:name="${applicationName}"
|
||||||
<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">
|
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
|
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||||
the Android process has started. This theme is visible to the user
|
the Android process has started. This theme is visible to the user
|
||||||
while the Flutter UI initializes. After that, this theme continues
|
while the Flutter UI initializes. After that, this theme continues
|
||||||
to determine the Window background behind the Flutter UI. -->
|
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>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
@@ -46,12 +52,14 @@
|
|||||||
</activity>
|
</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.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.android.application.versionCode" android:value="1" />
|
||||||
<!-- Don't delete the meta-data below.
|
<!-- Don't delete the meta-data below.
|
||||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
<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"/>
|
<activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait"
|
||||||
|
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|||||||
@@ -1,67 +1,67 @@
|
|||||||
import 'dart:async';
|
// import 'dart:async';
|
||||||
import 'package:background_location/background_location.dart';
|
// import 'package:background_location/background_location.dart';
|
||||||
import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
// import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class LocationBackgroundController extends GetxController {
|
// class LocationBackgroundController extends GetxController {
|
||||||
@override
|
// @override
|
||||||
void onInit() {
|
// void onInit() {
|
||||||
super.onInit();
|
// super.onInit();
|
||||||
requestLocationPermission();
|
// requestLocationPermission();
|
||||||
configureBackgroundLocation();
|
// configureBackgroundLocation();
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future<void> requestLocationPermission() async {
|
// Future<void> requestLocationPermission() async {
|
||||||
var status = await Permission.locationAlways.status;
|
// var status = await Permission.locationAlways.status;
|
||||||
if (!status.isGranted) {
|
// if (!status.isGranted) {
|
||||||
await Permission.locationAlways.request();
|
// await Permission.locationAlways.request();
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future<void> configureBackgroundLocation() async {
|
// Future<void> configureBackgroundLocation() async {
|
||||||
await BackgroundLocation.setAndroidNotification(
|
// await BackgroundLocation.setAndroidNotification(
|
||||||
title: "Background Location",
|
// title: "Background Location",
|
||||||
message: "Tracking location...",
|
// message: "Tracking location...",
|
||||||
icon: "@mipmap/ic_launcher",
|
// icon: "@mipmap/ic_launcher",
|
||||||
);
|
// );
|
||||||
|
|
||||||
BackgroundLocation.setAndroidConfiguration(1000);
|
// BackgroundLocation.setAndroidConfiguration(1000);
|
||||||
BackgroundLocation.startLocationService();
|
// BackgroundLocation.startLocationService();
|
||||||
BackgroundLocation.getLocationUpdates((location) {
|
// BackgroundLocation.getLocationUpdates((location) {
|
||||||
// Handle location updates here
|
// // Handle location updates here
|
||||||
print("New location: ${location.latitude}, ${location.longitude}");
|
// print("New location: ${location.latitude}, ${location.longitude}");
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
startBackLocation() async {
|
// startBackLocation() async {
|
||||||
Timer.periodic(const Duration(seconds: 5), (timer) {
|
// Timer.periodic(const Duration(seconds: 5), (timer) {
|
||||||
getBackgroundLocation();
|
// getBackgroundLocation();
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
getBackgroundLocation() async {
|
// getBackgroundLocation() async {
|
||||||
var status = await Permission.locationAlways.status;
|
// var status = await Permission.locationAlways.status;
|
||||||
if (status.isGranted) {
|
// if (status.isGranted) {
|
||||||
await BackgroundLocation.startLocationService(
|
// await BackgroundLocation.startLocationService(
|
||||||
distanceFilter: 20, forceAndroidLocationManager: true);
|
// distanceFilter: 20, forceAndroidLocationManager: true);
|
||||||
BackgroundLocation.setAndroidConfiguration(
|
// BackgroundLocation.setAndroidConfiguration(
|
||||||
Duration.microsecondsPerSecond); // Set interval to 5 seconds
|
// Duration.microsecondsPerSecond); // Set interval to 5 seconds
|
||||||
|
|
||||||
BackgroundLocation.getLocationUpdates((location1) {
|
// BackgroundLocation.getLocationUpdates((location1) {
|
||||||
print('''\n
|
// print('''\n
|
||||||
Latitude: ${location1.latitude.toString()}
|
// Latitude: ${location1.latitude.toString()}
|
||||||
Longitude: ${location1.longitude.toString()}
|
// Longitude: ${location1.longitude.toString()}
|
||||||
Altitude: ${location1.altitude.toString()}
|
// Altitude: ${location1.altitude.toString()}
|
||||||
Accuracy: ${location1.accuracy.toString()}
|
// Accuracy: ${location1.accuracy.toString()}
|
||||||
Bearing: ${location1.bearing.toString()}
|
// Bearing: ${location1.bearing.toString()}
|
||||||
Speed: ${location1.speed.toString()}
|
// Speed: ${location1.speed.toString()}
|
||||||
|
|
||||||
|
|
||||||
''');
|
// ''');
|
||||||
});
|
// });
|
||||||
} else {
|
// } else {
|
||||||
await Permission.locationAlways.request();
|
// await Permission.locationAlways.request();
|
||||||
print('Location permission not granted');
|
// print('Location permission not granted');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|||||||
@@ -58,14 +58,14 @@ void main() async {
|
|||||||
print(Get.deviceLocale!.countryCode);
|
print(Get.deviceLocale!.countryCode);
|
||||||
Stripe.publishableKey = AK.publishableKey;
|
Stripe.publishableKey = AK.publishableKey;
|
||||||
if (box.read(BoxName.driverID) != null) {
|
if (box.read(BoxName.driverID) != null) {
|
||||||
Get.defaultDialog(
|
// Get.defaultDialog(
|
||||||
title: 'Gps required',
|
// title: 'Gps required',
|
||||||
middleText: '',
|
// middleText: '',
|
||||||
confirm: MyElevatedButton(
|
// confirm: MyElevatedButton(
|
||||||
title: 'ok'.tr,
|
// title: 'ok'.tr,
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Get.put(LocationBackgroundController());
|
// Get.put(LocationBackgroundController());
|
||||||
}));
|
// }));
|
||||||
}
|
}
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(
|
||||||
|
|||||||
Reference in New Issue
Block a user