Two new supramolecular polymers based on HgI2, AgI and BPMB·2Br{BLMB = 1, 4-bis [(4-picoline)-N-methylene] benzene} have been synthesized via the self-assembly reaction in solution. They were {(BPMB)[HgI4(H2O)0.66]}(1), and {(BPMB)2[Ag4I8]}(2).We analyzed the structures of compounds 1–2 by X-ray single-crystal diffraction, infrared spectroscopy (IR) and characterized the properties of compounds 1–2 by fluorescence spectrum and ultraviolet-visible (UV-vis) absorption spectrum. The results indicated that compound 1 is the mononuclear structure; Compound 2 has the multinuclear cubane structure. Compounds 1–2 showed good photocatalytic abilities for methylene blue (MB) irradiated by visible light. The effective detection of Fe3+ was performed by compounds 1–2 as fluorescent sensors.