Barker served in the Revolutionary War and remained active in the military through 1808, when he retired as Major General of the First Brigade, First Division.
He was appointed an alderman of the city of Philadelphia by Governor Thomas McKean on October 22, 1800.
He was elected mayor by the Select and Common Councils on October 20, 1808, and was re-elected in 1809 and again, after an interval of two years, in 1812.
[2] His original interment is unknown but his remains were reinterred to Laurel Hill Cemetery in Philadelphia.
He was the father of playwright James Nelson Barker, who served in the army during the War of 1812, rising to the rank of major, and who was also later mayor of Philadelphia.