• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

Reading and Deleting SMS after OnSmsReceived Event

Started by Gerhard@DCE, August 29, 2013, 05:05:18 am

Previous topic - Next topic

Gerhard@DCE

How is the procedure of event OnSmsListItem working ?

After firing SmsList(True) I'll get back all SMS in GSM-Memory but cannot detect the end of list for initiating the deletion sequence.
I cannot see an idSms with value 0 after end of list.

Thanks for feedback
Gerhard

Roman Novgorodov

Hello

You can see how GSMDemo detects end of SMS list:

procedure TForm1.nrGsm1SmsListItem(Sender: TObject; aMem: String;
  idSms: Integer; aSms: TnrPduSms);
begin
  if aSms <> nil then begin
    if aSms.Report then begin
      Memo2.Lines.Add('REPORT: ' + aMem + ',' + IntToStr(idSms) + ' ======= ');
      Memo2.Lines.Add(aSms.ReportText);
    end else begin
      Memo2.Lines.Add('SMS: ' + aMem + ',' + IntToStr(idSms) + ' ======= ');
      Memo2.Lines.Add(aSms.Text);
    end;
  end else Memo2.Lines.Add('======= GET SMS LIST DONE!!! =============');
end;


Last event call sets aSms = nil

Roman Novgorodov
DeepSoftware llc
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

henry64

Quote from: Gerhard@DCE on August 29, 2013, 05:05:18 am
How is the procedure of event OnSmsListItem working ?

After firing SmsList(True) I'll get back all SMS in GSM-Memory but cannot detect the end of list for initiating the deletion sequence.
I cannot see an idSms with value 0 after end of list.

Thanks for feedback
Gerhard


I think you also have to set your nrGsm to store messages on the device, so you cannot use the "nsmSkipSave" if you want to read the smslist