During the taping of the Ellen show on Thursday, the president snapped a selfie with the talk show host who later posted the photo to Instagram.
But just one day before, the president was speaking at an event in Illinois, where he told the crowd to stop sticking cameras in his face.
Scroll down for video
‘Selfie with the Chief’: President Obama takes a selfie with Ellen DeGeneres just one day after he told an audience that instead of taking selfies, they would be shaking hands
Obama takes a ‘selfie’ on stage with a student from the ReNew Cultural Arts Academy during the White House Talent Show
Boston Red Sox designated hitter David ‘Big Papi’ Ortiz (left) takes a selfie with Obama, holding a No 44 Red Sox jersey presented to the president
The president warned his audience about taking selfies as he prepared to conclude remarks to supporters.
‘I wanna tell you ahead of time,’ he said. ‘If we had smartphones when I ran for president, I’m not sure I would have run.’
‘Folks just have their phones they won’t shake my hand anymore,’ gesturing like he was sticking a phone in his face.
Vice President, Joe Biden, takes a selfie with Obama
Obama and British Prime Minister David Cameron (left) pose for a selfie picture with Denmark’s former Prime Minister Helle Thorning-Schmidt (center) next to US First Lady Michelle Obama
After joking about how he may not have ran for president if cell phones were as prevalent then as they are now, he went on talking about the end of handshakes.
‘They won’t shake my hand anymore,’ he said. ‘It’s like, ‘Hey! I’m here! Live in front of you!’ he continued, laughing.
‘So we’re not taking selfies but I wanna shake as many hands as possible.’
Bill Nye the Science Guy (left) takes a selfie with Obama and astrophysicist, Neil deGrasse Tyson (right)
Obama agreed to spend a day with explorer Bear Grylls in the Alaskan wilds, where the pair got on famously, even stopping to take a selfie on their adventure
Obama takes a selfie with members of the U.S. Women’s National Soccer Team during a ceremony to honor them and their victory in the 2015 FIFA Women’s World Cup