I'm using location plugin with Google maps for flutter. When I try to give rotation to custom marker, android works perfectly but ios always returns -1. I tried flutter_compass but i read this plugin does not work Huawei, Xiaomi. What Can I do to solve this problem?
One way (probably not ideal) is to use location on Android and flutter_compass on iOS. You can perform a simple platform to see which one you're on:
if (Platform.isAndroid) {
// use location
else if (Platform.isIOS) {
// use flutter_compass
}
If the issues of flutter_compass with certain devices ever get patched, you can simply delete the check and use flutter_compass on both platforms.
Related
I am trying to use Huawei Location Kit(Fused Location Service) to get longitude and latitude. But the response I get back are all null.
Then, I call the requestLocationUpdates() method to obtain the device location and update the cache. But I got PlatformException. May I know why?
My current code to use Huawei Location Kit:
Log:
I tried your code in the project, it seems working.
Can you check whether agconnect-services.json and key file is put in correct place like this:
Project screenshot:
and the API has been enabled in AppGallery Connect:
AGConnect Screenshot:
In the new Location kit 6.0.0 version, Non-Huawei Android phones support only Fused location capability. See Docs.
In addition, only some interfaces are supported. Docs link.
The requestLocationUpdates interface you use here is not supported by Non-Huawei Android phones. You are advised to use the requestLocationUpdatesCb interface instead.
Or you could use version 5.1.0.303 of the Flutter plug-in.
I have an application built with Dart/Flutter that has user interaction that depends on the device's volume being on/turned up. I'm not seeing any obvious tutorials or packages available to determine this. How would I best go about approaching this? Am I overlooking a package or solution?
Most of the current packages support Android only.
https://pub.dev/packages/volume - Android only (example)
https://pub.dev/packages/flutter_volume/ - iOS and Android (example)
import 'package:flutter_volume/flutter_volume.dart';
// Return relative volume as double between 0.0 and 1.0
await FlutterVolume.volume;
I've started with Flutter and I´m currently working on a project which allows the application to mute the phone if you´re at a specified position. I´ve implemented Google Maps etc. Everything works except that the marker isn´t visible but that´s another question. My question is how I can mute the phone with an app. I didn´t find a solution anywhere.
I really doubt that Flutter provides such a fuctionality out of the box. I suggest searching 3rd party packages for it. If that fails you can implement this feature nativly on each platform using Platform Channels.
HERE you can find how to achieve this on Android, and HERE how to do it on IOS.
I am building an Android app which requires an intent to invoke front facing camera when device is lifted to certain height to take selfie. I am working on Android O (Android 8.0). So Please suggest me an easy way to invoke the front camera. I referred old codes but none of them were related to Android O.
Here is the code I've tried so far:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extras.CAMERA_FACING", android.hardware.Camera.CameraInfo.CAMERA_FACING_FRONT);
intent.putExtra("android.intent.extras.LENS_FACING_FRONT", 1);
intent.putExtra("android.intent.extra.USE_FRONT_CAMERA", true);
startActivityForResult(intent, REQUEST_CODE);
I am building an Android app which requires an intent to invoke front facing camera when device is lifted to certain height to take selfie.
Use the camera APIs (android.hardware.Camera or android.hardware.camera2.*). Or, use a library that wraps around them and makes their use easier, such as Fotoapparat or CameraKit-Android.
I referred old codes but none of them were related to Android O.
There is nothing about your problem that has anything to do with Android 8.0.
I'm very new at Flex Mobile Projects and native extension.
I have a big doubt... If I have an ANE that only works on iOS or Android, can I use it into a project for Android AND iOS?
I mean, if I want to do something and I've only found and ANE that works for iOS and another ANE that works for Android, can I create only one project and depending on the device use one or another? or should I create two different projects?
Thanks in advance
You should be able to correctly code using two different ANE's, one for each platform, but it does really depend on the ANE.
Most provide a isSupported flag to allow you to determine programmatically whether the extension is supported on the current platform.
if (ExtensionA.isSupported)
{
// Use extension A
}
else if (ExtensionB.isSupported)
{
// Use extension B
}
It's also worth noting that if the extension isn't correctly implementing a "default" version (i.e. one that gets used on unsupported platforms) this may fail. Really comes down to the ANE implementation.