android - Strange time in received sms -
android - Strange time in received sms -
when send myself sms message , add together history (before receiving) next code
private void addsentsmstohistory(string address, string message) { seek { contentvalues values = new contentvalues(); values.put("address", address); values.put("body", message); //values.put("date", datetime.now.ticks); //getcontentresolver.insert(android.net.uri.parse("content://sms/sent"), values); contentresolver.insert(android.net.uri.parse("content://sms/sent"), values); } grab (exception e) { //e.printstacktrace(); toast.maketext(application.context, string.format("sms cannot stored, becasue '{0}'", e.message), toastlength.long).show(); } } history shows next "sent 17:58" , received "01:02" date "mar 30 265688"
update 1:
sources can found https://github.com/constructor-igor allocated issue can found https://github.com/constructor-igor/sms2/issues/16 uploaded screens details of issue
update 2: found solution of issue:
var totalperiod = datetime.utcnow - new datetime(1970, 1, 1); long milliseconds = (long)totalperiod.totalmilliseconds; values.put("date", milliseconds);
found next solution of "strange" sms time:
var totalperiod = datetime.utcnow - new datetime(1970, 1, 1); long milliseconds = (long)totalperiod.totalmilliseconds; values.put("date", milliseconds); value "date" of contentvalues should contain "total milliseconds".
android xamarin sms
Comments
Post a Comment