The 19th century has widely been considered a time of peace in colonial India. The majority of Indians followed the rule of the British, with members of the government and police force being largely made up of Indians too. However, it must be noted that the Indian National Congress was formally established in 1885, marking the beginning of official nationalism in colonial India. However, despite this, the Indian National Congress was limited in its membership and political activities, therefore it did not pose as a major threat to the British colonial government.
Following India's large contribution to the British fight in the First World War, a sense of political consciousness began to emerge as people began to push for more self-governance. This was gradually granted, however Indian self-governance was still limited to minor factors such as education. It is important to stress that demands for self-governance at this time did not mean a push for independence from British rule, it simply meant more involvement in the country's policies. So, although WW1 saw a rise in nationalism, it did not pose as too much of a threat to British rule.
Arguably, it was not until World War Two that nationalism began to instill fear in British imperials. Having promised India that they would not be involved in future wars, the Indian people were furious when Britain declared them at war with Germany in 1939. Despite their large contribution to the war, British imperials still limited the amount of self-governance that Indians had. As a result, the end of WW2 saw a huge rise in the nationalist support and major outbursts of anti-imperial campaigns and a push for independence. This was eventually achieved following the partition of India in 1947. Overall, it can be argued that for the most part, nationalism did not pose as a huge threat to British imperial rule, and that WW2 was a catalyst for change, marking the point when colonial rule was weakened.