The younger boy, the one believed to have been holding the gun, got away with some sweets, but was taken into police custody a short time later.
Police believe he may have been under the influence of methamphetamine at the time.
Both boys are facing charges of aggravated robbery, while the 12-year-old will also be charged with assaulting and resisting police.
Detective Richard Garton believed the rifle was not loaded at the time and no ammunition was found when the address the teen had been at was searched.
Both boys, who covered their lower faces before entering the dairy, had been at an address in nearby Matthews Ave with six other young people. No adults were present, police said.
They then walked the short distance to the dairy, attracting the attention of a local probation officer as they entered the shop.
The younger boy allegedly presented the rifle at the shopkeeper and demanded money, stuffing sweets into his pockets as he did so.
The probation officer saw the boys fleeing and called the police, who found them at the Matthews Ave address.
There police said they were abused by the other young people, who locked the doors and windows.
Entry was forced and the two suspected offenders were found, along with the rifle and the clothes they had been wearing.
Police said the 12-year-old spat at a police officer, punching him in the face twice and kicking him in the mouth.
The boys were suspected to have been under the influence of methamphetamine.
The dairy was closed Monday morning while the victims were speaking to police and evidence was collected from the scene.
Inquiries are also being made into how the boy came to have a firearm.