Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A New Jersey man who allegedly posted a photo of a gun and money on Snapchat on Thursday was arrested that day by police who used the app's geolocation feature to locate him in a car.

Taishaun Cosme. Ocean County Prosecutor's Office

Taishaun Cosme, 24, of Brick, was charged with drug and weapons offenses, the Ocean County Prosecutor's Office said in a statement Tuesday.

The Barnegat Crime Reduction Unit alerted the prosecutor's office that a man was posting pictures on Snapchat of a firearm and money in his vehicle. Further investigation involving multiple police agencies in Ocean County revealed the man was Cosme, the prosecutor's office said.

Detectives used Snapchat's geolocation feature to determine he was in a car in Lakewood, and he was later pulled over.

After executing a court-authorized search of the vehicle, a .40 caliber semi-automatic gun, several rounds of hollow-point bullets, a significant amount of cocaine, a digital scale, and assorted paraphernalia indicative of drug distribution, were found, according to the prosecutor's office.

Cosme was taken to the Ocean County Jail, where he remains pending a detention hearing.