The electronic, magnetic, and thermodynamic properties of alkali/alkaline earth metal ion‐adsorbed gallium nitride nanocage (Ga5N10_NC) have been investigated using density functional theory. The results denote that alkali/alkaline earth‐metal ion‐adsorbed Ga5N10_NC systems are stable compounds, with the most stable adsorption site being the center of the cage ring. The partial density of states (PDOS) can estimate a certain charge assembly between Li+, Na+, K+/ Be2+, Mg2+, Ca2+ and Ga5N10_NC which indicate the complex dominant of metallic features as: Ca2+ > Mg2+ > Be2+ >> K+ > Na+ > Li+. For confirmation of magnetic‐alignment of Ga5N10_NC, monovalent (M+) and divalent (M2+) metal ions were added to the sample to measure the effects of metals on the magnetic‐alignment properties of Ga5N10_NC. Furthermore, the reported results of NMR spectroscopy have exhibited that both M+ and M2+ can be optimized to achieve optimal alignment of nanocage in the presence of an applied magnetic field; however, chemical shift anisotropy spans for Ca2+– and Mg2+–containing samples is due to Ca2+ and Mg2+ ions binding to Ga5N10_NC. Regarding IR spectroscopy, Li+@ Ga5N10_NC and Be2+@ Ga5N10_NC with more electronegativity appear the most fluctuations through adsorption process. Moreover, based on NQR analysis, Ca2+ has shown a different graph of electric potential during trapping in Ga5N10_NC compared to other metal cations. Based on the results of amounts in this research, the selectivity of metal ion adsorption by gallium nitride nanocage (ion sensor) has been approved as: K+>Na+> Li+ in alkali metals and Ca2+>Mg2+> Be2+ in alkaline earth metals.