Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
273 views
in Technique[技术] by (71.8m points)

android - NFC unavailable when camera is open

This is my Torch app:

final Camera.Parameters p;
Camera camera=Camera.open();

camera.setPreviewTexture(new SurfaceTexture(0));
p = camera.getParameters();

p.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
camera.setParameters(p);
camera.startPreview();

When my app is running, some devices cannot detect NFC tags. I noticed this happens with the Nexus 5X, specifically.

It appears certain devices can't detect NFC when the camera is running.

Can this problem be solved programmatically?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Unfortunately, no, but I sincerely hope Nexus 5X is the only device on which you will ever encounter this.

The reason is that pretty late in the development cycle of the 5X, it was found that the NFC controller polling introduced noise in the camera sensor. The only feasible fix at that time was to turn off NFC when the camera is opened :(


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...