99
11.2.4 Specification
■ Intent
(1) START intent
Package name:
Class name: jp.casio.ht.osupdateservice.StartUpdate
Extra:
(2) FINISHED message
Package name:
Class name: jp.casio.ht.osupdateservice.finishupdate
Extra:
■ How to issue the START intent
Application creates an Intent specifying the package name, class name, and extra and
invokes startActivity to call the OSUpdateService.
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClassName("jp.casio.ht.osupdateservice",
" jp.casio.ht.osupdateservice.StartUpdate");
Uri uri = Uri.parse(“PATH to the OS image file”);
intent.setData(uri);
startActivity(intent);
■ How to receive FINISHED intent
Receive a broadcast message ( i.e. "jp.casio.ht.remoteupdate.finishupdate" ) using the
broadcast receiver of the application.
FinishBroadcastReceiver receiver = new FinishBroadcastReceiver();
IntentFilter intentFilter= new
IntentFilter("jp.casio.ht.osupdateservice.finishupdate");
registerReceiver(receiver, intentFilter);
…
class FinishBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
String result: = bundle.getString("result");
}
}
■ Execution result can be judged by bundled result.
-1 OS update image file is not valid.
0 Update was completed normally.
1 Specified update has already been applied.
2 OS update service internal error.