[Android Application Development]-(23) Android SIP support

Source: Internet
Author: User

1. What is sip?

Step-by-Step sip

Ii. How to Use sip in Android?

Sipdroid, Demo: Android-SDK-Windows \ samples \ Android-9 \ sipdemo

3. Does the system support sip?

Android provides the SIP function since 2.3. The SIP-related APIs are stored in the directory frameworks/base/VoIP/Java/Android/NET/SIP and are included in the android.net. Sip package. Here is the whole process of solving the problem that does not support sip. It depends on the result of directly moving to the end of the article.

You must obtain the sipmanager instance before the SIP Operation:

SipManager.newInstance(Context);

Here, it is found that the Instance obtained by some devices is null. Find the newinstance method in sipmanager. java.

            /**        * Creates a manager instance. Returns null if SIP API is not supported.        *        * @param context application context for creating the manager object        * @return the manager instance or null if SIP API is not supported        */       public static SipManager newInstance(Context context) {           return (isApiSupported(context) ? new SipManager(context) : null);       }           /**        * Returns true if the SIP API is supported by the system.        */       public static boolean isApiSupported(Context context) {           return context.getPackageManager().hasSystemFeature(                   PackageManager.FEATURE_SIP);       }


Through debugging, hassystemfeature is found to be empty. Go on to view the hassystemfeature method in packagemanager. Java, Which is abstract.

      /**        * Check whether the given feature name is one of the available        * features as returned by {@link #getSystemAvailableFeatures()}.        *        * @return Returns true if the devices supports the feature, else        * false.        */       public abstract boolean hasSystemFeature(String name);


This method is implemented in services/Java/COM/Android/Server/PM/packagemanagerservice. java.

 public boolean hasSystemFeature(String name) {        synchronized (mPackages) {            return mAvailableFeatures.containsKey(name);        }    }


Packagemanager. feature_sip is not found in member mavailablefeatures, and flase is returned. Therefore, the sipmanager object cannot be created. In the packagemanagerservice class, the value of the member variable mavailablefeatures is set by reading the XML file in/system/permissions. By searching for the constant packagemanager. feature_sip, you can easily find two XML files related to the SIP, under the frameworks/base/data/etc/directory. Based on past experience, these two files exist, but they are not in the/system/permissions directory. It must have not been copied.

Continue searching and find in the vending. mk file under the Device directory. Copy two sip-related files under frameworks/base/data/etc/to make.

   PRODUCT_COPY_FILES += \       device/amlogic/g04ref/tablet_core_hardware.xml:system/etc/permissions/tablet_core_hardware.xml \       frameworks/base/data/etc/android.hardware.camera.front.xml:system/etc/permissions/android.hardware.camera.front.xml \       ...       frameworks/base/data/etc/android.software.sip.voip.xml:system/etc/permissions/android.software.sip.voip.xml \       frameworks/base/data/etc/android.software.sip.xml:system/etc/permissions/android.software.sip.xml

If you do not compile the system, you can directly copy the two files to the/system/permissions directory.

Original article, reproduced please indicate the source: http://blog.csdn.net/tangcheng_ OK


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.