Background location enabled for my app, play store rejected my app update. How to fix?

I am building a food delivery app in flutter, where it contains seller side, user side and driver side.
The app contains live tracking feature, which requires background location permission. But this leads to the rejection of the app. The foreground service location permission is required for android 14 to work for the background location.

This is the mail for rejection reason which I got from google.:

Issue found: Background location access not declared
We detected that your app contains at least one feature that requests access to location in the background, however your permission declaration form did not reflect this. Please log in to your Play Console to resubmit your location declaration form. You may either remove location in the background from your app or indicate that the usage is in the background.

Issue details

We found an issue in the following area(s):

Version code 26
About the Permissions and APIs that Access Sensitive Information policy
Requests for permission and APIs that access sensitive information should make sense to users. You may only request permissions and APIs that access sensitive information that are necessary to implement critical current features or services in your app that are promoted in your Google Play listing. You may not use permissions or APIs that access sensitive information that give access to user or device data for undisclosed, unimplemented, or disallowed features or purposes. Personal or sensitive data accessed through permissions or APIs that access sensitive information may never be sold nor shared for a purpose facilitating sale.

Request permissions and APIs that access sensitive information to access data in context (via incremental requests), so that users understand why your app is requesting the permission. Use the data only for purposes that the user has consented to. If you later wish to use the data for other purposes, you must ask users and make sure they affirmatively agree to the additional uses.*

This is my manifest.xml where all the location related permission is mentioned.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

Now How can I make the app approve? I am using Location package.

Future<void> _listenLocation() async {
  model.location.enableBackgroundMode(enable: true);
  locationStream = model.location.onLocationChanged.listen((event) async {
    logger.w("Is it Working.....");
    await FirebaseFirestore.instance
        .collection('location')
        .doc(widget.orderId.toString())
        .set({
      'latitude': event.latitude,
      'longitude': event.longitude,
      'dishOrderId': widget.orderId.toString()
    }, SetOptions(merge: true));
  });
}

This function is require for continuous updating of Driver location when the app is in background and google map is opened. But the catch is the location permission is in all time. Please tell me way to fix.

This is the message what we are passing for getting the background location permission in dialog box:

We need your permission to track your device’s location for accurate delivery of order. You can manage this permission in your device settings at any time.

This is the video link which we added to play console:

I have tried follow youtube videos to make the live tracking work but this requires background location. I don’t find any way to make the live tracking work with foreground location only in flutter. any help will be appreciated.

6

I think, you dont need ACCESS_BACKGROUND_LOCATION permission.

I assume, you use something like flutter_foreground_task or pigeon for fetching location in an android foreground service.

Your foreground serivce location fetching does NOT count as background.

ACCESS_BACKGROUND_LOCATION is created for WorkManagers/Alarm to do it actually in background when app was not even launched. Foreground services launched from the app don’t need this permission.

So, if driver presses “GO” button and you start a service with a notification it counts as foreground.

https://developer.android.com/develop/sensors-and-location/location/background

Permissions you should use

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />

Here is also a sample of foreground location.
https://pub.dev/packages/flutter_foreground_task

5

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật