Android GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this)在Google Play服务版本9.0.83上返回null

时间:2016-05-20 13:01:38

标签: android google-play-services android-sdk-2.3

我遇到了GooglePlayServiceUtil的问题,其中一些设备安装了9.0.83的google play服务。 我已经在具有播放服务版本8.7.03的设备中检查了相同的内容,我收到了法律通知。

以下是我用来获取法律声明的代码。

multiUploader.prototype._uploader = function(file,f){
    if(typeof file[f] != undefined && self._validate(file[f].type) > 0){
        var data = new FormData();
        var ids = file[f].name._unique();
        data.append('file',file[f]);
        data.append('index',ids);
        $(".sfmfiles[rel='"+ids+"']").find(".progress").show();
        $.ajax({
            type:"POST",
            url:this.config.uploadUrl,
            data:data,
            cache: false,
            contentType: false,
            processData: false,
            success:function(rponse){
                $("#"+ids).hide();
                var obj = $(".sfmfiles").get();
                $.each(obj,function(k,fle){
                    if($(fle).attr("rel") == rponse){
                        $(fle).slideUp("normal", function(){ $(this).remove(); });
                    }
                });
                if (f+1 < file.length) {
                    self._uploader(file,f+1);
                }
            }
        });
    } else
        console.log("Invalid file format - "+file[f].name);
}
对于版本9.0.83,

返回null。但它正在返回verion 8.7.03和7.x.x设备的法律声明字符串。

我也试过

TextView tv = (TextView) findViewById(R.id.notice);
if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS) {
        Toast.makeText(this, "ConnectionResult.SUCCESS", Toast.LENGTH_LONG).show();
        tv.setText(GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this));
}else if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SERVICE_MISSING){
        Toast.makeText(this, "ConnectionResult.SERVICE_MISSING", Toast.LENGTH_LONG).show();
}else if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SERVICE_DISABLED){
        Toast.makeText(this, "ConnectionResult.SERVICE_DISABLED", Toast.LENGTH_LONG).show();
}

GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(this) 

但结果与GooglePlayServicesUtil相同。 如果有人能指导我以获得正确的结果,那将会很有帮助。

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题,在升级Google Play服务(编写此答案时为9.0.0),重建项目并重新安装应用程序后,我开始正确获取许可证。

我正在使用GoogleApiAvailability.getInstance().getOpenSourceSoftwareLicenseInfo(this);