Hola Dani. Muchas gracias por la generosidad con que me
regalas tu tiempo, tu esfuerzo y tus conocimientos.
No puedo probar tu código.
Creo que se te ha olvidado copiar la declaración de la función ExtractName();
Quizá así no sea necesaria esta función:
Código Delphi
[-]procedure TForm1.Borra_Notifi(Id, FH: String);
function DateTimeLocalToUnixMSecGMT(const ADateTime: TDateTime): Int64;
begin
Result := DateTimeToUnix(ADateTime) * MSecsPerSec - Round(TTimeZone.Local.UtcOffset.TotalMilliseconds);
end;
var
NotificationsList: TStringList;
Notifications: JString;
I: Integer;
Found: Boolean;
PreferenceEditor: JSharedPreferences_Editor;
FPreference: JSharedPreferences;
begin
if DateTimeLocalToUnixMSecGMT(Now) > DateTimeLocalToUnixMSecGMT(StrToDateTime(FH)) then
Exit;
NotificationC.RequestPermission;
FPreference := TAndroidHelper.Context.getSharedPreferences(TJNotificationAlarm.JavaClass.NOTIFICATION_CENTER, TJContext.JavaClass.MODE_PRIVATE);
NotificationsList := TStringList.Create;
try
Notifications := FPreference.getString(TJNotificationAlarm.JavaClass.SETTINGS_NOTIFICATION_IDS, nil);
NotificationsList.Add(JStringToString(Notifications));
I := 0;
Found := False;
while not Found and (I < NotificationsList.Count) do
if NotificationsList[i] = Id then
Found := True
else
Inc(I);
if Found then
begin
PreferenceEditor := FPreference.edit;
try
NotificationsList.Delete(I);
PreferenceEditor.putString(TJNotificationAlarm.JavaClass.SETTINGS_NOTIFICATION_IDS, StringToJString(NotificationsList.Text));
finally
PreferenceEditor.commit;
end;
end;
finally
NotificationsList.Free;
end;
NotificationC.CancelNotification(Id);
end;
Un cordial saludo.