Sometimes in the hot season cicadas (in Thai, jakajan จักจัน) come out to find water. This year there isn’t much water (people line up at springs to fill containers now, up in the border mountains; we're likely to get severe storms with bad hail when rains finally come, and I bet there'll be flooding in Bangkok again) and the catching is quite easy.
Bamboo poles are set up on the dry sides of river beds, and the insects alight on them. Thinner poles with an end coated about a foot long with sticky stuff from what I thought was a coffee tree (but isn't) are poked at the cicadas, which often get stuck. An expert can catch several at once. Then you grab them off and put them in a bag to take home, while they complain vociferously. Before cooking in boiling water with a bit of oil, de-wing. Bon apetit! They taste like insects, but the nutritional value is not to be belittled - sure beats a mono-culture, GMO diet, in what you get from them.
The gluey sap comes from this tree, from the trunk or from the fruit.
Cicadas spend most of their lives as underground nymphs, emerging only after years. There are cicadas in Thailand every year though; perhaps there are slight differences different years. Although it is claimed that females lay their eggs in trees, my children dig them from the ground every year,