Depending on the selection of elements in the periodic table, a solid matter may consist of ionic bondings showing cation and anion: how big difference of electronegativity between the elements (e.g., Pauling's). Usually, transition metal oxides are typical materials that show ionic bondings. In a certain boundary condition (temperature, pressure, potential, etc.), cation/anion can become mobile and diffuse/drift.
Once we introduce two different solid matters showing the large difference of electrochemical potential as positive and negative electrodes, we can use the potential difference as an energy source. Meanwhile, mobile ions (H- or O-ion in a Fuel cell, Li-ion in Rechargeable battery) should be well shuttling reversibly between the two electrodes to use a system repeatably. Besides, an electrically insulating (but Ionic conducting) layer should be introduced in-between positive and negative for blocking internal electrical current and supplying it to the outer circuit. We can use them as an energy generation (storage) system.
A fuel cell is using H- or O-ion.
A rechargeable battery is using Li-ion (or other alkali ions).
These principles are similarly applied in oxide electronics while the electrical properties of a matter are employed. Drift/diffusion of mobile ions in a solid matter can modulate electrical resistivity. Once we systematically control ion drift/diffusion, resistive changes can be used as information storage.