There isn't a simple rule, as the definite and the indefinite article are used in different cases.
Eat an apple before going to the cinema.
The sentence is not referring to a particular apple; it can be a random one.
Follow the President.
The sentence is not referring to a random president.
The difference is not between talking of something the other person knows, or not.
In the second example, the person I am talking to could know all the presidents present in the meeting, but he will understand to which president I am referring.
Albert taught himself to play the violin.
Worry about the future.
In this case, the article is used to make a generalized reference to something rather than identifying a particular instance.
They placed the African elephant on their endangered list.
African elephant is referring to the whole species, not to a single elephant.
She is a McFry.
The sentence is referring to a member of the family McFry.