Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] In Android, getting the coordinates is null. #836

Closed
iseruuuuu opened this issue Sep 27, 2022 · 3 comments
Closed

[BUG] In Android, getting the coordinates is null. #836

iseruuuuu opened this issue Sep 27, 2022 · 3 comments

Comments

@iseruuuuu
Copy link

iseruuuuu commented Sep 27, 2022

Describe the bug
In Android, getting the coordinates is null.
I created a camera roll in my app using your Package.
For iOS, I was able to get each of the coordinates, but for Android, they both come back null.

If you check the Android camera roll and look at the photo information, you will see that the coordinates are well acquired.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

code

 Future<void> fetchNewMedia() async {
    lastPage = currentPage;
    final result = await PhotoManager.requestPermissionExtend();
    if (result.isAuth) {
      const option = FilterOption(
        needTitle: true,
        sizeConstraint: SizeConstraint(
          ignoreSize: true,
        ),
      );
      final filterOptionGroup = FilterOptionGroup();
      filterOptionGroup.setOption(AssetType.image, option);
      final albums =
          await PhotoManager.getAssetPathList(filterOption: filterOptionGroup);
      final media =
          await albums[0].getAssetListPaged(size: 60, page: currentPage);
      final temp = <Widget>[];
      for (final asset in media) {
        var position = await asset.latlngAsync();
        temp.add(
          FutureBuilder(
            future: asset.thumbnailDataWithSize(
              const ThumbnailSize(200, 200),
            ),
            builder:
                (BuildContext context, AsyncSnapshot<Uint8List?> snapshot) {
              if (snapshot.connectionState == ConnectionState.done) {
                return GestureDetector(
                  onTap: () async {
                    print(position.longitude);
                    print(position.latitude);
                    print(asset.latitude);
                    print(asset.longitude);
                  },
                  child: Stack(
                    children: <Widget>[
                      Positioned.fill(
                        child: Image.memory(
                          snapshot.data!,
                          fit: BoxFit.cover,
                        ),
                      ),
                    ],
                  ),
                );
              }
              return Container();
            },
          ),
        );
      }
      setState(() {
        mediaList.addAll(temp);
        currentPage++;
      });
    }
  }

Screenshots
If applicable, add screenshots to help explain your problem.

Flutter version

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Log
If applicable, add logs to help explain your problem.

Flutter Doctor

[✓] Flutter (Channel stable, 3.0.2, on macOS 12.2.1 21D62 darwin-x64, locale ja-JP)
    • Flutter version 3.0.2 at /Users/ryutaroiseki/fvm/versions/3.0.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (4 months ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ryutaroiseki/Library/Android/sdk
    • Platform android-33, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.70.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (4 available)
    • SH M08 (mobile)            • 357779092880341                      • android-arm64  • Android 9 (API 28)
    • iPhone 12 Pro Max (mobile) • D8FAECF6-FE17-4D2C-AE75-8C53D37A3A8B • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found![✓] Flutter (Channel stable, 3.0.2, on macOS 12.2.1 21D62 darwin-x64, locale ja-JP)
    • Flutter version 3.0.2 at /Users/ryutaroiseki/fvm/versions/3.0.2
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision cd41fdd495 (4 months ago), 2022-06-08 09:52:13 -0700
    • Engine revision f15f824b57
    • Dart version 2.17.3
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ryutaroiseki/Library/Android/sdk
    • Platform android-33, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.70.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (4 available)
    • SH M08 (mobile)            • 357779092880341                      • android-arm64  • Android 9 (API 28)
    • iPhone 12 Pro Max (mobile) • D8FAECF6-FE17-4D2C-AE75-8C53D37A3A8B • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)            • macos                                • darwin-x64     • macOS 12.2.1 21D62 darwin-x64
    • Chrome (web)               • chrome                               • web-javascript • Google Chrome 105.0.5195.125

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
@vishnukvmd
Copy link
Contributor

On Android, make sure that you have listed ACCESS_MEDIA_LOCATION within your manifest file.

@iseruuuuu
Copy link
Author

thanks i try it

@AlexV525
Copy link
Member

AlexV525 commented Oct 11, 2022

##### Android 10 media location permission
Due to the privacy policy issues on Android 10,
it is necessary to grant the location permission
to obtain the original data with the location info
and the EXIF metadata.
If you want to use the location permission,
add the `ACCESS_MEDIA_LOCATION` permission to your manifest.

@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants