As Ron suggests, the meaning really decides whether the "-ing" form is used as a Participle or a Gerund. However, two approximate techniques that often work:
1. Technique 1: This works especially for identifying Participial phrases. Try to add "the" before the "-ing" form of the verb. If the sentence becomes absolutely non-sensical, it is a participle. For example, following does not make sense "at all":
(The) Playing cricket, he gained health.
2. Technique 2: Unlike English, many other languages do not have this issue of using the same word ("-ing" form of verb) both as Participle and Gerund. So, translate the sentence into your native and see if you can make out the difference more easily.
In Hindi, for example (which you might know), if you translate the corresponding sentence and the translation of the "-ing" form ends in the Hindi "na", it is a Gerund, else it is a participle.
Hunting deer is not allowed in this country.
Hindi: Deers ko hunt karnaa is not allowed in this country.
Technique 2 almost always works:). While I have demonstrated it in one language for illustration, you can see if it works in the language that you know.