Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to read /proc/kmsg in my android app live. But it keeps throwing me FILE NOT FOUND.I am hoping that somebody can help.

C#
try {
            StringBuilder a=new StringBuilder();
            BufferedReader b=new BufferedReader(new FileReader("/proc/kmsg"));;
            String row;

            while((row=b.readLine())!= null){
                a.append(row+"\n");
            }

            String c=a.toString();


        } catch (FileNotFoundException e) {
            Toast.makeText(this, "FILE NOT FOUND!!!" , Toast.LENGTH_LONG).show();
            e.printStackTrace();
        } catch (IOException e) {
Posted

1 solution

Well you will need a rooted phone to enter SU before you can access the kernel messages. try looking at

Reading Kernel messages[^]

You can just monitor from a host system via

#adb shell cat /proc/kmsg

Hope it helps

/Darren
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900