Under the next king, James II, brother of Charles, matters were different. James converted to Roman Catholicism, the religion of his mother, and political turmoil followed. James issued a decree known as the Declaration of Indulgence, which decreed that various public offices formerly open only to Anglicans, should thereafter be open to all persons. It was feared that the King would appoint large numbers of Roman Catholics to positions of power, and eventually transfer to them the control of the government. When the King commanded the bishops to proclaim the Declaration of Indulgence, seven of them refused to do so and were by the King's command imprisoned in the Tower of London. The people of London rioted, and the bishops were freed and carried in triumph through the streets of the city. Soon after, Parliament offered the crown to the King's daughter Mary and her husband William of Orange (see above) and James fled into exile.
William and Mary naturally began their reign by demanding oaths of allegiance from all persons holding public positions, including the bishops. Thomas Ken and others (known as the Non-Jurors -- the older meaning of "juror" is "one who takes an oath," hence "perjurer" as "one who swears falsely") refused to take the oath, on the grounds that they had sworn allegiance to James, and could not during his lifetime swear allegiance to another monarch without making such oaths a mockery. They were accordingly put out of office.
The bishops of Scotland also refused the oath, and William and Mary retaliated by disestablishing the Church in Scotland and making the Presbyterians the official state Church there instead. Therefore, we have in Scotland today the Kirk of Scotland (a Presbyterian Calvinist group which is the established Church there), The Episcopal Kirk of Scotland (an Anglican Church, what is known as a "free" Church in the sense of having no ties with the government), the Free Kirk of Scotland (broken off from the Kirk of Scotland), and the Wee Free Kirk of Scotland (broken off from the Free Kirk-- everyone calls them the "Wee Frees" and I do not remember their official name).
Thomas Ken became a private tutor and spent the rest of his life in retirement. He died 19 March 1711 and is usually commemorated on 21 March. During his lifetime he was known for his books of sermons. Today, he is best known for several hymns that he wrote, such as
Awake, my soul, and with the sun All praise to thee, who safe has kept All praise to thee, my God, this night Praise God, from whom all blessings flow