在的Nexus 7和LG擎天柱LTE应用的不同行为 [英] different behaviour of app in Nexus 7 and LG Optimus LTE
问题描述
我的应用程序在/ SD卡的文件夹结果写入一个名为 filename.dat
我可以在平板电脑中删除亚行这个文件,使用命令亚行外壳RM /sdcard/filename.dat
结果
我用这个平板电脑仅用于开发,没有别的,所以我安装了很少的应用程序,而这些也特定于事情,我发展的需要,如文件浏览器结果
我想,正在被应用于LG擎天柱LTE手机同样的事情,所以有很多安装其他应用程序,包括那些需要personl日常工作结果的
当我尝试相同的命令,结果亚行外壳RM /sdcard/filename.dat
结果
在LG的手机,它拒绝这样做的结果 RM失败/sdcard/filename.dat,权限被拒绝
结果
为什么表现这种方式?
My app writes a file called filename.dat
in the /sdcard folder
I can delete this file from adb in the tablet, using the command
adb shell rm /sdcard/filename.dat
I use this tablet only for development and nothing else, so I have very few apps installed on it, and those are also specific to things that I need to develop, such as file explorer
I tried the same thing in LG Optimus LTE phone that is actively being used, and so has lots of other apps installed, including those needed for personl daily work
When I try the same command,
adb shell rm /sdcard/filename.dat
in the LG phone, it refuses to do so
rm failed for /sdcard/filename.dat, Permission denied
Why is it behaving this way?
更重要的是,在我测试程序,它工作正常,所有的时间都在的Nexus 7,但是当我尝试在手机上运行它,它工作正常的第一次,但是当我这样做第二时间,在程序中的变量中的一个开始越来越NaN值(我已经跟踪它是由于一种无限/无限分裂发生在一条线路),然后每次我再次执行它,它显示了这些NaN值。该计划是太长排除有人不熟悉它,我猜,但它使用AudioTrack和AudioRecord类以声音输入,就可以执行一些FFT和DSP操作,然后回放。
More importantly, in the program that I am testing, it works fine all the time in the Nexus 7, but when I try to run it on the phone, it works fine the first time, but when I do so the second time, one of the variables in the program starts getting NaN values (I have tracked it down to be due to an Infinity/Infinity division taking place on one of the lines), then everytime I execute it again, it shows these NaN values. The program is too long to troubleshoot for someone unfamiliar with it I guess, but it uses AudioTrack and AudioRecord classes to take sound input, perform some FFT and DSP operations on it, then play it back.
我真正需要知道的是,它是什么,是平板电脑和手机之间的不同,这可能会导致这样的问题,有什么其他的事情,我可能需要考虑?
What I really need to know is, what is it that is different between tablet and phone, that might be causing a problem like this, and what are the other things I might need to consider?
我初始化AudioRecord和AudioTrack为
I initialize the AudioRecord and AudioTrack as
int min = AudioRecord.getMinBufferSize(16000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT);
record = new AudioRecord(MediaRecorder.AudioSource.VOICE_COMMUNICATION, 16000, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, min);
int maxJitter = AudioTrack.getMinBufferSize(SAMPLE_FREQUENCY, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT);
track = new AudioTrack(AudioManager.MODE_IN_COMMUNICATION, 16000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, maxJitter, AudioTrack.MODE_STREAM);
我认为这可能是相关与这个特定的程序,因为使用比MODE_IN_COMMUNICATION,如MODE_VOICE_CALL以外的东西,看起来编译正常,但给出了类似的问题,即使是在的Nexus 7。
I think this might be relevant to this particular program, since using something other than MODE_IN_COMMUNICATION, such as MODE_VOICE_CALL, seems to compile fine but gives similar problems, even in the Nexus 7.
推荐答案
您可以尝试 System.getenv(EXTERNAL_STORAGE)
来获取外部存储目录,而不是使用 / SD卡/
。在我的经验,这是在大多数情况下是相同的。但是,这应该每次给你一个正确的输出目录。
You could try System.getenv("EXTERNAL_STORAGE")
to get the external storage directory instead of using /sdcard/
. In my experiences this was the same in most cases. But this should give you a correct output directory every time.
这篇关于在的Nexus 7和LG擎天柱LTE应用的不同行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!