Using telephony functionality from Android app
I am just getting started developing my first Android app, and one function that I need the app to do is to be able to place a voice call and play a recording into the call.
I have been looking all over the place and I cannot find the ability to do this in t开发者_开发百科he Android SDK. I do see there is com.android.internal.telephony which does seem to offer the ability but I also read that apps are not supposed to use this because it is not part of the SDK.
Am I understanding things correctly that there is no way for an Android app to be able to do this (make an actual voice call)? Any help would be appreciated.
You should read up on intents. The specific intent that you're looking for in this case is Intent.ACTION_CALL. For this intent to work you have to put <uses-permission android:name="android.permission.CALL_PHONE" />
into the applications AndroidManifest.xml.
It is not possible to play sounds during conversations. See this topic from the Android Developers web site for more details.
Use smth like this:
Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "+1-800-1234567"));
activity.startActivity(intent);
And do not forget to declare aforementioned permission "android.permission.CALL_PHONE"
If you are planning for something like Internet telephony you have look into this http://developer.android.com/guide/topics/connectivity/sip.html
精彩评论