【问题标题】:Ajax Request Doesn't Work In Live Google Play AppAjax 请求在实时 Google Play 应用程序中不起作用
【发布时间】:2019-01-17 11:11:57
【问题描述】:

我有一个 Phonegap 应用程序。它在 phonegap 提供的调试和 apk 文件中完美运行。但是当我上传到 Google Play 并从这里下载时,我的 ajax 请求不起作用。我添加了权限和

<access origin="*" />

在 config.xml 中,但问题没有解决。

我的 ajax 行是:

cordova.plugins.barcodeScanner.scan(
        function (result) {
            var radioValue = $("input[name='optradio']:checked").val();
            if ($('input.refakat').is(':checked')) {
                var ref = "1";
            }
            else {
                var ref = "0";
            }
            // alert(radioValue);
            $.get( "https://example.com/api.php?barkod&id2="+result.text+"&ogun="+radioValue+"&ref="+ref+"&session="+localStorage.getItem("session"), function( data ) {
                $( ".result" ).html( data );
                // alert( "Load was performed." );
            });
        }

【问题讨论】:

    标签: android jquery ajax google-play phonegap


    【解决方案1】:

    如果您使用的是 Google Play 应用签名,您的 APK 将使用来自 Google Play 的不同密钥进行签名。我怀疑您的 AJAX 请求位于检查请求的 APK 证书签名密钥的服务器上。如果您注册 Google Play 证书哈希,它应该可以工作。请参阅部分中的the documentation

    • 选择加入新应用
    • 第 3 步:向 API 提供商注册您的应用签名密钥

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-31
      • 1970-01-01
      • 2014-08-20
      • 2021-11-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多