Yes, I would say Crematogaster genus. If it was in Portugal I would say probably C. scutellaris since it nests in the wood. Where was the picture taken?
Yes. Crematogaster spp. I'm not sure about the species. This is one of the easiest way to recognize Crematogaster by looking at their abdomen. heart-shaped gaster (sometimes they are referred to Love ants, Valentine ants), and they usually raised their abdomen when they are alerting any suspicious movement--like us! :). Common in Malaysian cocoa plantation. Feeding on homopteran pests of cocoa, coccidae and pseudococcidae
Crematogaster (subfamily Myrmicinae)
Postpetiole articulated on dorsal surface of first gastral segment; the gaster in dorsal view roughly heart-shaped and capable of being bent forward over the alitrunk. Petiole dorsoventrally flattened without a node. Holldobler & Wilson, The ants. 1990.
They are definitely Crematogaster sp. as the other five researchers have mentioned. They are also commonly known as Cocktail ants. If you are interested in knowing the species name, consult Brian Taylor or Brian Fisher (California Academy of Sciences).
Their association with stingless bees could be to offer protection in exchange for food.
It is common to find ants near stingless bee nests. For one the ants like to use the cavities of the stingless bee wooden nests, and second, many ants are predators of stingless bees as well. Did you observe any interactions between the ants and the bees?