I was last week in Nairobi and now near Mombasa. Nairobi is in African standards clean and reasonably safe (not so much after dark though). International hotels allow visitors (they like money and are in a hospitality business). Grindr is exploding, but expect many tricksters and conmen. Pictured are often not the reality. Many guys are probably sincere but they look a bit rough and hotel security will be surprised when you enter hotel (xray or just sitting guy checking). I did not have courage to try out. In beach resort found a massage guy with own booth and he did extra, was ok. I guess experienced gay expats can have good time. Main thing to consider that most guys have smaller or severe income issues. And Africa is anyhow intense for European, so keep your head cool😀.
ps while gaysex is illegal, the extreme worse case is an extortion. White guys are still somehow respected (colonial past pluss money), so the extertion is mostly problem for locals (“we tell your relatives”). Racism is sometimed an issue between locals (kenyans-somalis-hindus), not so much for visitors.