Called when the activity is first created.
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button addpbtn = (Button) findViewById(R.id.addpkg);
Button procbtn = (Button) findViewById(R.id.procmsg);
Button delbtn = (Button) findViewById(R.id.delpkg);
Log.v(LOG_TAG, "activity created!!");
addpbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText app_id = (EditText) findViewById(R.id.app_id);
EditText cont = (EditText) findViewById(R.id.cont);
EditText pkg = (EditText) findViewById(R.id.pkg);
EditText cls = (EditText) findViewById(R.id.cls);
RadioButton act = (RadioButton) findViewById(R.id.act);
CheckBox sig = (CheckBox) findViewById(R.id.sig);
CheckBox ftr = (CheckBox) findViewById(R.id.ftr);
try {
if (!mWapPushMan.addPackage(
app_id.getText().toString(),
cont.getText().toString(),
pkg.getText().toString(),
cls.getText().toString(),
act.isChecked() ? WapPushManagerParams.APP_TYPE_ACTIVITY :
WapPushManagerParams.APP_TYPE_SERVICE,
sig.isChecked(), ftr.isChecked())) {
Log.w(LOG_TAG, "remote add pkg failed...");
mWapPushMan.updatePackage(
app_id.getText().toString(),
cont.getText().toString(),
pkg.getText().toString(),
cls.getText().toString(),
act.isChecked() ? WapPushManagerParams.APP_TYPE_ACTIVITY :
WapPushManagerParams.APP_TYPE_SERVICE,
sig.isChecked(), ftr.isChecked());
}
} catch (RemoteException e) {
Log.w(LOG_TAG, "remote func failed...");
}
}
});
delbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText app_id = (EditText) findViewById(R.id.app_id);
EditText cont = (EditText) findViewById(R.id.cont);
EditText pkg = (EditText) findViewById(R.id.pkg);
EditText cls = (EditText) findViewById(R.id.cls);
// CheckBox delall = (CheckBox) findViewById(R.id.delall);
// Log.d(LOG_TAG, "button clicked");
try {
mWapPushMan.deletePackage(
app_id.getText().toString(),
cont.getText().toString(),
pkg.getText().toString(),
cls.getText().toString());
// delall.isChecked());
} catch (RemoteException e) {
Log.w(LOG_TAG, "remote func failed...");
}
}
});
procbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
EditText pdu = (EditText) findViewById(R.id.pdu);
EditText app_id = (EditText) findViewById(R.id.app_id);
EditText cont = (EditText) findViewById(R.id.cont);
// WapPushOverSms wap = new WapPushOverSms();
// wap.dispatchWapPdu(strToHex(pdu.getText().toString()));
try {
Intent intent = new Intent();
intent.putExtra("transactionId", 0);
intent.putExtra("pduType", 6);
intent.putExtra("header",
HexDump.hexStringToByteArray(pdu.getText().toString()));
intent.putExtra("data",
HexDump.hexStringToByteArray(pdu.getText().toString()));
mWapPushMan.processMessage(
app_id.getText().toString(),
cont.getText().toString(),
intent);
//HexDump.hexStringToByteArray(pdu.getText().toString()), 0, 6, 5, 5);
} catch (RemoteException e) {
Log.w(LOG_TAG, "remote func failed...");
}
}
});