首页 > 解决方案 > 将 appbundle 上传到 Google Play 控制台后如何检测测试设备

问题描述

我的应用程序允许匿名用户单击调用我的 API 的按钮。我想过滤掉应用程序抓取的测试设备。它们似乎不是 Firebase 测试实验室的一部分。脚步:

  1. 在 Google Play Console 中开始新的应用发布。
  2. 在“Android App Bundles and APKs to add”部分上传应用程序包。
  3. 等待大约五分钟。请勿继续执行第 2 步“审查和推出”。
  4. 检查我的服务器日志。
  5. 在多个 IP 上 有来自 android MTC20F 的调用(由 dart:io Platform报告),例如
    • 64.233.172.32
    • 66.249.88.64
    • 74.125.210.33
  6. Firebase测试实验室系统变量为空。

标签: androidgoogle-play-console

解决方案


如果它可以提供帮助,当应用程序在 Google Play 的测试服务器上进行审查/运行时,我注意到一个奇怪的副作用,即我无法访问缓存目录以在 Android 上列出:

FileSystemException: Directory listing failed, path = '/data/user/0/my.package.name/cache/random_folder/' (OS Error: Invalid argument, errno = 22)

导致此错误的代码是:

Future<List<File>> getFilesInDirectory(String directoryPath) async {
  // `directoryPath` is fetched on Android side with `context.cacheDir`
  final cacheDir = Directory(directoryPath);

  final files = <File>[];
  // This call succeeds, .. I still don't get why :D
  if (!cacheDir.existsSync()) return files; 

  final completer = Completer();
  // Tries to list all files in the folder
  cacheDir.list(followLinks: false).listen(
    (file) {
      if (file is! File) {
        return;
      }

      files.add(file as File);
    },
    onDone: () => completer.complete(),
    onError: (err) {
      log(err) // <---- This is where I get the error
    }
  );
  await completer.future;
  return files;
}

推荐阅读