diff --git a/gen/org/scorelab/sense/R.java b/gen/org/scorelab/sense/R.java index b15b617..bebda71 100644 --- a/gen/org/scorelab/sense/R.java +++ b/gen/org/scorelab/sense/R.java @@ -1,48 +1,48 @@ -/* AUTO-GENERATED FILE. DO NOT MODIFY. - * - * This class was automatically generated by the - * aapt tool from the resource data it found. It - * should not be modified by hand. - */ - -package org.scorelab.sense; - -public final class R { - public static final class attr { - } - public static final class drawable { - public static final int ic_launcher=0x7f020000; - public static final int icon=0x7f020001; - } - public static final class string { - public static final int app_name=0x7f030000; - } - public static final class style { - /** - Base application theme, dependent on API level. This theme is replaced - by AppBaseTheme from res/values-vXX/styles.xml on newer devices. - - - Theme customizations available in newer API levels can go in - res/values-vXX/styles.xml, while customizations related to - backward-compatibility can go here. - - - Base application theme for API 11+. This theme completely replaces - AppBaseTheme from res/values/styles.xml on API 11+ devices. - - API 11 theme customizations can go here. - - Base application theme for API 14+. This theme completely replaces - AppBaseTheme from BOTH res/values/styles.xml and - res/values-v11/styles.xml on API 14+ devices. - - API 14 theme customizations can go here. - */ - public static final int AppBaseTheme=0x7f040000; - /** Application theme. - All customizations that are NOT specific to a particular API-level can go here. - */ - public static final int AppTheme=0x7f040001; - } -} +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package org.scorelab.sense; + +public final class R { + public static final class attr { + } + public static final class drawable { + public static final int ic_launcher=0x7f020000; + public static final int icon=0x7f020001; + } + public static final class string { + public static final int app_name=0x7f030000; + } + public static final class style { + /** + Base application theme, dependent on API level. This theme is replaced + by AppBaseTheme from res/values-vXX/styles.xml on newer devices. + + + Theme customizations available in newer API levels can go in + res/values-vXX/styles.xml, while customizations related to + backward-compatibility can go here. + + + Base application theme for API 11+. This theme completely replaces + AppBaseTheme from res/values/styles.xml on API 11+ devices. + + API 11 theme customizations can go here. + + Base application theme for API 14+. This theme completely replaces + AppBaseTheme from BOTH res/values/styles.xml and + res/values-v11/styles.xml on API 14+ devices. + + API 14 theme customizations can go here. + */ + public static final int AppBaseTheme=0x7f040000; + /** Application theme. + All customizations that are NOT specific to a particular API-level can go here. + */ + public static final int AppTheme=0x7f040001; + } +} diff --git a/src/org/scorelab/sense/dataCollector/sms/observe/SmsObserveData.java b/src/org/scorelab/sense/dataCollector/sms/observe/SmsObserveData.java new file mode 100644 index 0000000..5cbc8e3 --- /dev/null +++ b/src/org/scorelab/sense/dataCollector/sms/observe/SmsObserveData.java @@ -0,0 +1,17 @@ +package org.scorelab.sense.dataCollector.sms.observe; + +import org.scorelab.sense.annotation.Attributes; + +public class SmsObserveData { + @Attributes(primaryKey = true) + public String toAddress; + public String messageLength; + public String messageTimestamp; + @Attributes(primaryKey = true) + public String timestamp; + public String collectTimestamp; + + public SmsObserveData(String toAddress, String messageLength, String messageTimestamp){ + + } +} diff --git a/src/org/scorelab/sense/dataCollector/sms/observe/SmsObserveDataReader.java b/src/org/scorelab/sense/dataCollector/sms/observe/SmsObserveDataReader.java new file mode 100644 index 0000000..71ac89a --- /dev/null +++ b/src/org/scorelab/sense/dataCollector/sms/observe/SmsObserveDataReader.java @@ -0,0 +1,60 @@ +package org.scorelab.sense.dataCollector.sms.observe; + +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +import org.scorelab.sense.util.SenseLog; + +import android.content.Context; +import android.database.ContentObserver; +import android.database.Cursor; +import android.net.Uri; +import android.os.Handler; + +public class SmsObserveDataReader extends ContentObserver { + + private MessageDigest sensMessageDigest; + Context context; + + public SmsObserveDataReader(Handler handler) { + super(handler); + } + + @Override + public void onChange(boolean selfChange) { + super.onChange(selfChange); + + try { + sensMessageDigest = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + SenseLog.w("NoSuchAlgorithmException Throws"); + } + + Uri sMSURI = Uri.parse("content://sms/"); + + Cursor cursor = context.getContentResolver().query(sMSURI, null, null, + null, null); + + while (cursor.moveToNext()) { + + String toAddress = cursor.getString(cursor + .getColumnIndex("address")); + int messageLength = cursor.getString(cursor.getColumnIndex("body")) + .length(); + long messageTimestamp = cursor.getLong(cursor + .getColumnIndex("date")); + + sensMessageDigest.reset(); + byte[] fromAdressDigest = sensMessageDigest.digest(toAddress + .getBytes()); + BigInteger bigIntegerOfFromAdress = new BigInteger(1, + fromAdressDigest); + String fromAddressHash = bigIntegerOfFromAdress.toString(); + } + + ; + + } + +}