Flutter : google map dont show - flutter

I have flutter app using google map, I created project and api key in google cloud,and enabled for both Andriod and iOS.
I add these permisions to AndroidManifest.xml :
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
also ad Api Key to AndroidManifest.xml:
<application
android:label="xxxx"
android:icon="#mipmap/launcher_icon">
<activity
.............
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"/>
then I used getlocator package to get location in provider for showing the map :
GoogleMap(
mapType: MapType.normal,
initialCameraPosition: CameraPosition(
target: LatLng(authProvider.latitudePosition,
authProvider.longitudePosition),
zoom: 14))
nothing to show on emulator (the emulator using google play) also I get this :
updateAcquireFence: Did not find frame.

Related

I am having issues uploading my app to Google playstore

I have been trying to upload my flutter app to playstore, but it got rejected, I got an email like this below
This is how my pubspec.yaml file look like
my Androidmanifest file
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test" xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
I was thinking maybe the permission_handler is the cause of the rejection,
but based on my research online, I believe it suppose to go through since I added this
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove"/>
I think you misunderstood the Google Playstore message.
They are telling you that your app shouldn't use this permission:
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" tools:node="remove"/>
So you have two options:
Either Remove this permission request from your app or
argue with the Google Playstore support about why your app really needs this permission. They list a few allowed cases (web browsing as a core functionality for example)

Why with wifi I can connect but not with my mobile data

Hello I have a problem this morning that I did not meet. with wifi I can connect with the application but not with my mobile data. Can anyone help me? Here is the content of
AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission
android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:label="FACTURA"
android:name="${applicationName}"
android:icon="#mipmap/ic_launcher">
<activity
Starting with Android API 28 and iOS 9, these platforms disable insecure HTTP connections by default.
You can use this code:
Add network-policy at your meta-data in AndroidManifest.xml file:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
....
<meta-data android:name="io.flutter.network-policy"
android:resource="#xml/network_security_config"/>
Allowing cleartext connection for debug builds:
Look at: $project_path\android\app\src\debug\AndroidManifest.xml:
<application android:usesCleartextTraffic="true"/>
You can see this documentation:
https://docs.flutter.dev/release/breaking-changes/network-policy-ios-android

java.lang.SecurityException: Need android.permission.BLUETOOTH_CONNECT permission

After asking for runtime permission for BLUETOOTH_CONNECT, android 12 crashes , I faced this problem in Samsung Android 12 Device. In other device less then Android 12 is working fine.
I handled bluetooth permission but still my app going to crash
manifest
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
sdk -> 31
Showing this type of error after build the app.
I got the solution.
As you can see the BLUETOOTH permission is disabled in Android 12. This issue resolved if I add the maxSdkVersion for the BLUETOOTH permission.
So I update permissions in manifest file :
Old This:
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
to
new this:
<uses-permission android:name="android.permission.BLUETOOTH" android:maxSdkVersion="30" android:required="false" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" android:maxSdkVersion="30" android:required="false" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" android:maxSdkVersion="30" android:required="false" />

google_maps_flutter only works on IOS. I'm having a problem when it comes to Android

Edit :
We decided to use OpenStreetMap instead of Google Maps. Actually, we were thinking of returning to OpenStreetMap in the future, but we did not want to spoil what was written. We made this decision because the fix would be too costly. Thanks for yours helps.
The project in use will be added to the project to add extra features. After adding maps that work smoothly on IOS, when it comes to Android, I get the error "Unexpected response code 503 for https://clients4.google.com/glm/mmap/api" in the Debug Console section. The full error is below...
what did i check
api key connection
Android Emulator (Creating a different project containing Google Maps. It worked with the android emulator without any problem, but the screen does not appear in the project where I got the error.)
dependencies update
Emulator has google play services
Full Error Code
Unexpected response code 503 for https://clients4.google.com/glm/mmap/api
W/MobStoreFlagStore(26335): java.util.concurrent.ExecutionException: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.dotdotdot.dotdot_dotdot, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
W/MobStoreFlagStore(26335): at agw.s(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):3)
W/MobStoreFlagStore(26335): at agw.get(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):2)
W/MobStoreFlagStore(26335): at aig.g(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):2)
W/MobStoreFlagStore(26335): at wy.c(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):1)
W/MobStoreFlagStore(26335): at xa.run(:com.google.android.gms.dynamite_mapsdynamite#221514081#22.15.14 (150400-0):0)
W/MobStoreFlagStore(26335): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/MobStoreFlagStore(26335): at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/MobStoreFlagStore(26335): at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
W/MobStoreFlagStore(26335): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/MobStoreFlagStore(26335): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/MobStoreFlagStore(26335): at java.lang.Thread.run(Thread.java:923)
W/MobStoreFlagStore(26335): Caused by: java.lang.SecurityException: GoogleCertificatesRslt: not allowed: pkg=com.bilicisoft.visit_ankara, sha256=[de6158b2bcbe47a9e13cccf90dc960571efc28ca09f89e29840e87729f126466], atk=false, ver=221514037.true (go/gsrlt)
W/MobStoreFlagStore(26335): at android.os.Parcel.createExceptionOrNull(Parcel.java:2373)
W/MobStoreFlagStore(26335): at android.os.Parcel.createException(Parcel.java:2357)
W/MobStoreFlagStore(26335): at android.os.Parcel.readException(Parcel.java:2340)
W/MobStoreFlagStore(26335): at android.os.Parcel.readException(Parcel.java:2282)
Error Code ScreenShots
Dependencies
environment:
sdk: ">=2.16.2 <3.0.0"
dependencies:
mobx: ^2.0.1
flutter_mobx: ^2.0.0
mobx_codegen: ^2.0.1+3
build_runner: ^2.0.6
easy_localization: ^3.0.0
shared_preferences: ^2.0.0
dio: ^4.0.0
google_maps_flutter: 2.1.5
Google Maps Code
(I remind you again. This code doesn't work for me on Android, but it does on iOS. I don't think there is a problem with the code.)
Container(
height: 300,
child: googleMap.GoogleMap(
mapType: googleMap.MapType.normal,
initialCameraPosition: googleMap.CameraPosition(
target: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0),
zoom: 15,
),
onMapCreated: (googleMap.GoogleMapController controller) {
_controller.complete(controller);
},
markers: Set<googleMap.Marker>.of([
googleMap.Marker(
markerId: googleMap.MarkerId(_place?.title ?? ""),
position: googleMap.LatLng(_place?.lat ?? 0, _place?.lng ?? 0))
]),
),
),
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dotdot.dot_dot>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
</intent>
</queries>
<application
android:label="APP Name"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
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">
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyC_K9N2..........ASD_s4"/>
</application>
</manifest>
trying out all the above in Summary:
Enabled Android and iOs SDK on Cloud Console
Added Secret Key to Android Manifest
Adding Map on my App
Running the command Flutter clean
check all config google map for android
Uninstall the app from your device (Phone or Emulator) then compile afresh.
Below permissions missing in your androidfestml file check out,
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dotdot.dot_dot>
//add this one
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:label="APP Name"
android:icon="#mipmap/ic_launcher"
android:usesCleartextTraffic="true">
//add this too
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />

Is it possible in Google Play why an App is not compatible with a device?

Within the AndroidManifest.xml I can see the following lines:
<uses-sdk android:minSdkVersion="16" />
<uses-feature android:glEsVersion="0x00020000" />
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true"/>
<uses-feature android:name="android.hardware.sensor.gyroscope" android:required="true"/>
<uses-permission android:name="android.permission.NFC"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
So I guess the compatibility issue is due to some of the followings:
minSdkVersion
accelerometer
gyroscope
Is it possible to know which one/s is the compatibility issue within Google Play. Should we check one by one "manually"?
According with the answer of Google, it seems that nowadays we have to check it manually as I have stated in the question.
The answer of Google was: "If you'd like to know why specific device is not compatible with the app, you'll need to check if all the features you requested in the APK are supported by the device. Also you'll need to check the Android version"