Skip to content

安卓新机不支持。版本android9,已找到原因 #175

Open
@zc422

Description

@zc422

作者判断时候是判断X.0版本号的(X为1-9),而新机(如 华为mate20)安卓版本号为9,并非9.0,故判断不到,所以导致生成不了二维码。故将n方法里改为如下图代码即可
image

Activity

uhowep

uhowep commented on Dec 22, 2018

@uhowep

thanks so much

zc422

zc422 commented on Dec 22, 2018

@zc422
Author

@uhowep happy to help you

LLprince

LLprince commented on Dec 29, 2018

@LLprince

666,thanks

LLprince

LLprince commented on Dec 29, 2018

@LLprince
zc422

zc422 commented on Dec 29, 2018

@zc422
Author
xiaoxiaoyisheng

xiaoxiaoyisheng commented on Feb 21, 2019

@xiaoxiaoyisheng

改一下版本号的正则表达式不是更简单吗?
var aMat = sAgent.toString().match(/android ([0-9].[0-9])/i);
这句话改为
var aMat = sAgent.toString().match(/android (([0-9]).?[0-9]?)/i);

spencer17x

spencer17x commented on Feb 28, 2019

@spencer17x

试了还是不行,二维码是能生成,但是长按没反应

zc422

zc422 commented on Feb 28, 2019

@zc422
Author

@XuZpeng ,在微信里长按没反应吗?

zc422

zc422 commented on Feb 28, 2019

@zc422
Author

@xiaoxiaoyisheng 当时没管那么多。🤔

spencer17x

spencer17x commented on Feb 28, 2019

@spencer17x

@zc422 是的,就安卓9就不行,其他都行,二维码是正常生成了的,之前也是正常,升级了系统就凉了

zc422

zc422 commented on Feb 28, 2019

@zc422
Author

@XuZpeng 方便发代码来看下吗

spencer17x

spencer17x commented on Feb 28, 2019

@spencer17x

js:
new QRCode($('.qrcode')[0], {
text: "https://xcx.hexiaoxiang.com/cup_race?refer_id=" + refer_id + "&record_id=" + record_id,
width: 128,
height: 128
});

html:


spencer17x

spencer17x commented on Feb 28, 2019

@spencer17x

@zc422
function _getAndroid() {
var android = false;
var sAgent = navigator.userAgent;

	if (/android/i.test(sAgent)) { // android
		android = true;
		var aMat = sAgent.toString().match(/android ([0-9].?[0-9]?)/i);
		
		if (aMat && aMat[1]) {
			android = parseFloat(aMat[1]);
		}
	}
	
	return android;
}

源码我都试了还是不行。。

spencer17x

spencer17x commented on Feb 28, 2019

@spencer17x

作者为啥不把修复过的代码添加到仓库里,我看仓库里的代码还是旧的。

xikedafeige

xikedafeige commented on Mar 11, 2019

@xikedafeige

@我跟他一样的问题

13 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @westdrug@LLprince@SkyLandBeast@yaohaohao-xinqing@uhowep

        Issue actions

          安卓新机不支持。版本android9,已找到原因 · Issue #175 · davidshimjs/qrcodejs