简体   繁体   English

Android:手电筒可以在Galaxy 10英寸平板电脑上正常工作,但不能在Galaxy 7英寸平板电脑上正常工作

[英]Android: Flashlight working fine in Galaxy 10 inch Tablet but not in Galaxy 7 inch Tablet

I am using android's Flash Light to turn on the flashlight from within my app, its working fine for 1.Sony Xperia 2.Galaxy Tab 10 inches But, accidentally the same code is not working for Samsung Galaxy Tab 7 inches. 我正在使用android的Flash Light从我的应用程序中打开手电筒,它对于1.Sony Xperia 2.Galaxy Tab 10英寸工作正常,但是,偶然地,相同的代码不适用于7英寸的Samsung Galaxy Tab。

The method i have written is : 我写的方法是:

 private void toggleFlashlight() {
    Parameters p = mCamera.getParameters();
    if (!mToogleFlashlight) {
        mToogleFlashlight = true;
        p.setFlashMode(Parameters.FLASH_MODE_TORCH);
    } else {
        mToogleFlashlight = false;
        p.setFlashMode(Parameters.FLASH_MODE_OFF);
    }
    if (mCamera != null) {
        mCamera.setParameters(p);
    }
 }

Along with this I have also included the permissions and feature list I had to, in the AndroidManifest.xml 除此之外,我还在AndroidManifest.xml添加了我必须拥有的权限和功能列表。

Only if there was some problem in the Manifest(either some tag was missing) it wouldnt work for the other devices as well. 仅当清单中存在问题(缺少某些标签)时,其他设备也无法使用。 I mean I can not track this what kind of mind boggling issue this is. 我的意思是我无法追踪这是什么令人难以置信的问题。 Please help me with some fix, have deadlines to meet and already screwed in this issue. 请帮助我进行一些修复,有一个截止日期,并且已经解决了这个问题。

I think this solves your problem. 我认为可以解决您的问题。
Maybe you should also test the behavior with this app . 也许您也应该使用此应用程序测试行为。 It has an debug screen pressing the "Volume down"-button (originally posted here) . 它具有一个调试屏幕,按下“降低音量”按钮(最初在此处发布)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM