So if I pop open a command prompt and take a peek at my device's /proc/meminfo, like so:
adb shell cat /proc/meminfo
I get back what you'd expect - a nice long list of data on the device's RAM usage + capacity. But when I try to read that same location from an adobe air android app, using this basic code:
var meminfo:File = new File().resolvePath('/proc/meminfo');
meminfo.addEventListener(Event.COMPLETE, function(e:Event):void {
trace(File(e.target).data);
});
meminfo.load();
... I get nothing, just an empty ByteArray.
So why can I see the contents of /proc/meminfo from the adb shell, but not from the app? Same goes for other stuff in the /proc/ directory - cpuinfo, for instance. I have no problem loading an xml file from the /etc/ directory, though.
It turns out that if you copy memtest (or cputest, etc.) out to another location, somewhere a little friendlier to AIR - say, File.documentsDirectory - then everything goes smoothly.
Your code might look a little like this:
var meminfo_original:File = new File().resolvePath('/proc/meminfo');
var meminfo_copy:File = File.documentsDirectory.resolvePath('meminfo.txt');
meminfo_original.copyTo(meminfo_copy, true);
meminfo_copy.addEventListener(Event.COMPLETE, function(e:Event):void {
trace(File(e.target).data.toString());
});
meminfo_copy.load();