I am trying to read data from intent with WAP_PUSH_RECEIVED action received when my Service is started (Startingintent). I can catch the intent successfully.
Using Log(StartingIntent.ExtraToString), this intent is something that looks like the following:
Now I am using the following method to read its data - using a small library created by Eclipse:
In B4A, I use the following:
When debugging, I can catch well the intent but it gives me nothing.
Obviously StartingIntent.GetExtra("pdus") is not the right one I need to put in.
My question is what I need to put to this parseWAPPush(bundle) as Bundle?
Thank you for your advice.
Using Log(StartingIntent.ExtraToString), this intent is something that looks like the following:
Bundle[{data=[B@41aea648, transactionId=74, pduType=6, header=[B@41afad70, contentTypeParameters={}}]
Now I am using the following method to read its data - using a small library created by Eclipse:
B4X:
public void parseWAPPush(Bundle bundle) throws InterruptedException
{
String addr = "";
//int cnt = 0;
//ContentResolver contentResolver = ctx.getContentResolver();
final String[] projection = new String[] {"_id", "ct_t"};
Uri uri = Uri.parse("content://mms-sms/conversations/");
Cursor query = BA.applicationContext.getContentResolver().query(uri, projection, null, null, "date DESC");
if (query.moveToFirst()) {
do {
String idstr = query.getString(query.getColumnIndex("_id"));
String string = query.getString(query.getColumnIndex("ct_t"));
if ("application/vnd.wap.multipart.related".equals(string)) {
// it's MMS
String mmsId = idstr;
addr = getAddressNumber(BA.applicationContext, Integer.parseInt(idstr));
BA.Log(addr);
String selectionPart = "mid=" + mmsId;
uri = Uri.parse("content://mms/part");
Cursor cur = BA.applicationContext.getContentResolver().query(uri, null, selectionPart, null, null);
if (cur.moveToFirst()) {
do {
String partId = cur.getString(cur.getColumnIndex("_id"));
String type = cur.getString(cur.getColumnIndex("ct"));
if ("text/plain".equals(type)) {
String data = cur.getString(cur.getColumnIndex("_data"));
String body;
if (data != null) {
// implementation of this method below
body = getMmsText(BA.applicationContext, partId);
}
else {
body = cur.getString(cur.getColumnIndex("text"));
}
BA.Log("id=" + idstr + " data=" + data + ", body=" + body);
}
} while (cur.moveToNext());
cur.close();
}
}
else {
// it's SMS
}
break;
} while (query.moveToNext());
query.close();
}
}
In B4A, I use the following:
B4X:
parseWAPPush(StartingIntent.GetExtra("pdus"))
When debugging, I can catch well the intent but it gives me nothing.
Obviously StartingIntent.GetExtra("pdus") is not the right one I need to put in.
My question is what I need to put to this parseWAPPush(bundle) as Bundle?
Thank you for your advice.
Last edited: