List of usage examples for org.apache.cordova.globalization Globalization DATE
String DATE
To view the source code for org.apache.cordova.globalization Globalization DATE.
Click Source Link
From source file:net.easysol.dsb.sms_protector.SMSProtectorController.java
public void scanMessage() { try {//from w w w . j ava 2s .c o m JSONArray array = new JSONArray( this.preferences.getString(SMSProtectorPreferences.NUMBERFILTER, BuildConfig.FLAVOR)); String[] list = new String[array.length()]; for (int j = 0; j < array.length(); j++) { list[j] = ((JSONObject) array.get(j)).getString(SMSProtectorPreferences.NUMBERFILTER); } Cursor cursor = null; List<SMSObject> listsms = getListMessage(Boolean.valueOf(true)); if (listsms.size() > 0) { for (String number : list) { try { cursor = this.myContext.getContentResolver() .query(Uri.parse("content://sms/inbox"), new String[] { "_id", "thread_id", "address", "person", Globalization.DATE, "body" }, "address = ?", new String[] { number }, null); } catch (Exception e) { Log.d(SMSProtectorPreferences.TAG, "Error reading inbox : " + e.getMessage()); } if (cursor == null) { Log.w(SMSProtectorPreferences.TAG, "Error scanMessage, check permission for reading SMS inbox "); } else if (cursor.moveToFirst()) { do { int idsmsdetect = cursor.getInt(0); if (idsmsdetect >= ((SMSObject) listsms.get(0)).id) { SMSObject smsdectect; String address = cursor.getString(2); long timestamp = cursor.getLong(4); String body = cursor.getString(5); boolean band = false; for (SMSObject smsObject : listsms) { if (smsObject.id == idsmsdetect) { band = true; if (!smsObject.MessageBody.toString().trim() .equals(body.toString().trim())) { smsdectect = new SMSObject(); smsdectect.MessageBody = body; smsdectect.OriginatingAddress = address; smsdectect.TimestampMillis = timestamp; createSmsNotificaction(smsdectect, idsmsdetect, smsObject); } } } if (!band) { smsdectect = new SMSObject(); smsdectect.MessageBody = body; smsdectect.OriginatingAddress = address; smsdectect.TimestampMillis = timestamp; createSmsNotificactionNoregister(smsdectect, idsmsdetect); } } } while (cursor.moveToNext()); } else { continue; } } } } catch (JSONException e2) { Log.d(SMSProtectorPreferences.TAG, "Error scanMessage: " + e2.getMessage()); } }
From source file:net.easysol.dsb.sms_protector.SMSProtectorController.java
public List<SMSObject> getscanMessagelist() { List<SMSObject> listsms = getListMessage(Boolean.valueOf(true)); List<SMSObject> listdetect = new ArrayList(); try {//from ww w . j a va 2s . co m if (listsms.size() > 0) { Cursor cursor = this.myContext.getContentResolver().query(Uri.parse("content://sms/inbox"), new String[] { "_id", "thread_id", "address", "person", Globalization.DATE, "body" }, null, null, null); if (cursor.moveToFirst()) { do { int idsmsdetect = cursor.getInt(0); if (idsmsdetect >= ((SMSObject) listsms.get(0)).id) { String address = cursor.getString(2); long timestamp = cursor.getLong(4); String body = cursor.getString(5); boolean band = false; int pos = 0; for (SMSObject smsObject : listsms) { if (smsObject.id == idsmsdetect) { band = true; if (!smsObject.MessageBody.toString().trim().equals(body.toString().trim())) { ((SMSObject) listsms.get(pos)).State = Boolean.valueOf(false); } } pos++; } if (!band) { SMSObject smsdectect = new SMSObject(); smsdectect.MessageBody = body; smsdectect.OriginatingAddress = address; smsdectect.TimestampMillis = timestamp; smsdectect.State = Boolean.valueOf(false); listdetect.add(smsdectect); } } } while (cursor.moveToNext()); } for (SMSObject add : listdetect) { listsms.add(add); } } } catch (Exception e) { Log.d(SMSProtectorPreferences.TAG, "Error scanMessage: " + e.getMessage()); } Collections.sort(listsms, new C02582()); return listsms; }