ABSTRACT: To understand the environmental and contextual influences of illicit cocaine and heroin use and craving using mobile health (mHealth) methods.Interactive mHealth methods of ecological momentary assessment (EMA) were utilized in the Exposure Assessment in Current Time (EXACT) study to assess drug use and craving among urban drug users in real time. Participants were provided with mobile devices and asked to self-report every time they either craved (without using) or used heroin or cocaine for 30 days from November 2008 through May 2013.Baltimore, MD, USA.A total of 109 participants from the AIDS Linked to the IntraVenous Experience (ALIVE) study.For each drug use or craving event, participants answered questions concerning their drug use, current mood and their social, physical and activity environments. Odds ratios (OR) of drug use versus craving were obtained from logistic regression models with generalized estimating equations of all reported events.Participants were a median of 48.5 years old, 90% African American, 52% male and 59% HIV-infected. Participants were significantly more likely to report use rather than craving drugs if they were with someone who was using drugs [adjusted odds ratio (aOR)?=?1.45, 95% confidence interval (CI)?=?1.13, 1.86), in an abandoned space (aOR?=?6.65, 95% CI?=?1.78, 24.84) or walking/wandering (aOR?=?1.68, 95% CI?=?1.11, 2.54). Craving drugs was associated with being with a child (aOR?=?0.26, 95% CI?=?0.12, 0.59), eating (aOR?=?0.54, 95% CI?=?0.34, 0.85) or being at the doctor's office (aOR?=?0.31, 95% CI?=?0.12, 0.80).There are distinct drug using and craving environments among urban drug users, which may provide a framework for developing real-time context-sensitive interventions.