A phone app and a database of more than 50 million voters were key weapons in the successful campaign of cricket legend Imran Khan in last month's general election.