Issue
I am using node-webkit and ADBkit to attempt to read a line from an android build.prop and do something depending on what that line is.
full script at http://pastebin.com/7N7t1akk
The gist of it is this:
var model = client.shell(devices, "su -c 'grep ro.product.model /system/build.prop'" );
alert(model)
i want to read ro.product.model
from build.prop into the variable model
As a test im simply attempting to create an alert
that displays the return of this shell command, in my case ro.product.model=KFSOWI
but whenever i run this script with a connected device the alert
returns object Object
edit**
Ive just realized that client.getProperties(serial[, callback])
would probably work better but dont understand these functions (specifically callback) very well
I am very new to this area of Javascripting and home someone can offer some insight
Solution
JavaScript is asynchronous programming language, it is built on callbacks. Every function should have callback with data passed to it, if you will watch on documentation, you have client.shell(serial, command[, callback])
so data from executing client.shell()
will be passed to callback
. You should assign some function that will process callback, for your case will be this
client.shell(devices, "su -c 'grep ro.product.model /system/build.prop'", function(data) {
console.log(data);
});
P.S. there is no alert
in nodejs
Answered By - monkeyinsight
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.