質問

I want to build an alarm application but I don't know how to set off an alarm ringtone when the alarm has gone off. How do I do this?

役に立ちましたか?

解決

Since youre Question is pretty broad and generic, I cant provide exact Code but i can point you to the things you need to do.

You need to create a PendingIntent which starts a Service. In the Service you need to play the Sound with a MediaPlayer. The Media Playback Link also has a specific section on playing Sound in a Service. To schedule the PendingIntent to be fired at a certain time and start the service then, use AlarmManager.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top