The police are entitled to talk to people and ask people to identify themselves during their general duties. There is no law that stops the police from trying to engage people in conversations.
Citizens are under no legal obligation to answer police questions or even to give their names to the police just because the police ask for identity. Except for certain situations, it is not against the law to not give your name to the police.
If the police tell you that you are under arrest or under ‘investigative detention’ for an offence – you must identify yourself to the police. If you refuse, you can be arrested for ‘obstruction of justice’.
If you are driving a vehicle, and the police stop a vehicle, you must provide your identification and vehicle documentation to the police.
In Alberta, if you are a passenger in a car, the police cannot demand your identification unless the police officer observes the passenger is violating part of the Traffic Safety Act (e.g. not wearing a seatbelt), or violating a Municipal by-law. If you are a pedestrian on the street, the police may demand your identification if you are ‘acting in a manner contrary’ to the Traffic Safety Act or a bylaw.
In short – the police can approach people and talk to people. In most cases, there is no obligation on members of the public to talk to the police or answer their questions. If you have been involved in a car accident, or otherwise in a traffic stop by police, or if you are being detained or arrested, you must give your name to the police.