TAILIEUCHUNG - Lập trình Androi part 47

Nhiều, nếu không phải hầu hết, các thiết bị Android sẽ được điện thoại. Như vậy, không chỉ người dùng sẽ được dự kiến sẽ diễn ra và nhận cuộc gọi bằng cách sử dụng Android, nhưng bạn sẽ có cơ hội để giúp họ gọi ra, nếu bạn muốn. | Chapter Handling Telephone Calls Many if not most Android devices will be phones. As such not only will users be expecting to place and receive calls using Android but you will have the opportunity to help them place calls if you wish. Why might you want to Maybe you are writing an Android interface to a sales management application a la and you want to offer users the ability to call prospects with a single button click and without them needing to keep those contacts both in your application and in the phone s contacts application. Maybe you are writing a social networking application and the roster of phone numbers that you can access shifts constantly so rather than try to synchronize the social network contacts with the phone s contact database you let people place calls directly from your application. Maybe you are creating an alternative interface to the existing contacts system perhaps for users with reduced motor control . the elderly sporting big buttons and the like to make it easier for them to place calls. Whatever the reason Android has the means to let you manipulate the phone just like any other piece of the Android system. Report to the Manager To get at much of the phone API you use the TelephonyManager. That class lets you do things like the following Determine if the phone is in use via getCallState with return values of CALL_STATE_IDLE phone not in use CALL_STATE_RINGING call requested but still being connected and CALL_STATE_OFFHOOK call in progress . 311 312 CHAPTER 34 Handling Telephone Calls Find out the SIM ID IMSI via getSubscriberId . Find out the phone type . GSM via getPhoneType or find out the data connection type . GPRS or EDGE via getNetworkType . You Make the Call You can also initiate a call from your application such as from a phone number you obtained through your own web service. To do this simply craft an ACTION_DIAL Intent with a Uri of the form tel NNNNN where NNNNN is the phone number to dial and use

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.