To play an alarm through headphones on an Android device, you can use third-party apps that offer this functionality. Here's a concise guide based on the search results:
Sleep as Android: Install the Sleep as Android app from the Play Store. Open the app, go to Settings > Alarm default settings > Alarm output, and set it to "Force headphones only".
SoundAbout: Install SoundAbout from the Play Store. Go to Settings > Alert Behaviour > Wired Headset behaviour > Notifications to, and set it to "Wired Headset (override)".
Earphone Alarm: Download the Earphone Alarm app from the Play Store. This app allows you to set alarms that ring from earphones. You can choose the alarm sound, adjust the volume, and set options for when earphones are not connected.
Please note that the availability and functionality of these apps may change over time, and some users have reported issues with the "Force headphones only" feature on certain devices. Always check the app's reviews and compatibility with your specific Android version before using it for your alarm needs.