Kearney had claimed that he’d asked the boy his age and was told that he was 16.
However, the court was told that the profile picture on the lad’s Facebook account was clearly an image of a child.
In another picture a school tie was draped over a chair in the background.
Kearney pleaded guilty on indictment to sending written sexual communications to the 12-year-old, sending sexually explicit messages on Facebook and causing the child to look at a picture of his private parts.
He also admitted to possession of indecent photos or pseudo photos of a child.
His lawyer said: “My submission, given Mr Kearney’s age and the fact that this is a first offence, would be for a lengthy community payback order with the maximum amount of unpaid work hours.”
Sheriff Hamilton rejected the suggestion and told Kearney: “From a clear objective view the complainer here is a child.
“You set up fake accounts and it seems to me you planned this and you initiated it.
“There is no alternative to custody.”
Kearney, whose address wasn’t given in court, has been jailed for 14 months.
His name will also be on the Sex Offenders Register for the next 10 years.