I added the code below to the corresponding sections of the ipkgservice.java file of the ipkgservice service that you instructed me to look at.
I then installed it in my emulator and then I modified my Palm Backup Util's main-assistant.
js file to look like the doRescan function of the Luna Manager app. My assumption is that the startButton function in my Palm Pre Backup app should act just like the doRescan function of the Luna Manager app. In that they put in a call to ipkgservice to run 'backup' and 'rescan' respectively.
Apparently this is a wrong assumption. It does not execute the script that I have told it to....
Code:
private JSONObject startButton(ServiceMessage msg)
throws JSONException, LSException {
JSONObject reply = new JSONObject();
ReturnResult ret = executeCMD("/opt/bin/ppbku");
reply.put("returnValue",(ret.returnValue == 0));
reply.put("stdOut", ret.stdOut.toString());
reply.put("stdErr", ret.stdErr.toString());
if (ret.returnValue!=0) {
reply.put("errorCode", ErrorMessage.ERROR_CODE_METHOD_EXCEPTION);
reply.put("errorText", "Failure during 'Backup' operation");
}
return reply;
}
Code:
@LunaServiceThread.PublicMethod
public void backup(ServiceMessage msg)
throws JSONException, LSException {
JSONObject reply = startButton(msg);
msg.respond(reply.toString());
}
Of course the Main-Assistant.
js of the Palm Pre Backup app looks like ....
Code:
MainAssistant.prototype.continueBtn = function(event)
{
try
{
this.controller.get("announcement").update("Processing...");
this.controller.stageController.pushScene('process', this.checkboxBRModel, this.checkboxPDModel);
var r = new Mojo.Service.Request
(
'palm://org.webosinternals.ipkgservice',
{
method: 'backup',
onSuccess: this.callbackFunction.bindAsEventListener(this, 'Backup'),
onFailure: this.callbackFunction.bindAsEventListener(this, 'Backup')
}
);
}
catch (e)
{
Mojo.Log.logException(e, 'main#continueBtn');
this.alertMessage('main#continueBtn Error', e);
}
}