开发者

How to make an android phone ring programatically AS IF it was receiving a call?

开发者 https://www.devze.com 2023-03-31 23:10 出处:网络
First off, I\'m a beginner in mobile development. I\'ve seen many similar questions but none of them would answer specifically this.

First off, I'm a beginner in mobile development. I've seen many similar questions but none of them would answer specifically this.

I'm developing a game for android, platform target 2.2, in Java (eclipse, android sdk, avd, etc), and w开发者_StackOverflow中文版ould like to know if there's a way to make the phone ring (based on the current ringtone, settings, etc) as if you were receiving a call from your app.

Think of it as if one of the characters of the game would be calling you, to notify you about something (for example, you could let something in a game kind of 'oven', and your assistant would call you when the food is ready)

Is it possible?


IMHO this is not possible. If you want to do that you have to create an Activity with a layout similar to that of the incoming-call-screen. Sure you can use the Android code as it is open source: Layout Directory on GIT


I know you can get the curremtly selected ringtone from the preferences: http://developer.android.com/reference/android/preference/RingtonePreference.html

and then you should have a look at music players http://developer.android.com/guide/topics/media/index.html

and play your ringtone and of course creating that custom Activity Martin is talking about

0

精彩评论

暂无评论...
验证码 换一张
取 消