Changes between Version 51 and Version 52 of Getting-Started/Android


Ignore:
Timestamp:
Apr 21, 2015 5:08:10 AM (10 years ago)
Author:
nanang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/Android

    v51 v52  
    120120 - using real device: http://developer.android.com/tools/device.html 
    121121 
    122 == Building and running pjsua sample application == #pjsua 
    123  
    124 We have pjsua sample application located under {{{pjsip-apps/src/pjsua/android}}}. It is not built by default, and you need [http://www.swig.org/download.html SWIG] to build it. 
     122 
     123== Building and running pjsua2 sample application == #pjsua2 
     124 
     125A sample application using [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 API] with SWIG Java binding, is located under {{{pjsip-apps/src/swig/java/android}}}. It is not built by default, and you need [http://www.swig.org/download.html SWIG] to build it. 
     126 
     127Follow these steps to build pjsua2 sample application: 
     128 1. Make sure SWIG is in the build environment PATH. 
     129 1. Run {{{make}}} from directory {{{$PJDIR/pjsip-apps/src/swig}}} (note that the Android NDK root should be in the PATH), e.g: 
     130     {{{ 
     131$ cd /path/to/your/pjsip/dir 
     132$ cd pjsip-apps/src/swig 
     133$ make 
     134     }}} 
     135 1. Make sure any library dependencies are copied to {{{$PJDIR/pjsip-apps/src/swig/java/android/libs/armeabi}}}, e.g: {{{libyuv.so & libopenh264.so}}} for video support. 
     136 1. Create Android project from pjsua. In Eclipse: 
     137    a. From menu: '''File''' --> '''New''' --> '''Project''' 
     138    a. Select '''Android Project from Existing Code''', press '''Next''' 
     139    a. In ''Root Directory'', put the location of '''pjsua2''' source code (i.e. {{{$PJDIR/pjsip-apps/src/swig/java/android}}}) and press '''Finish''' 
     140 1. You may need to select different Android SDK than what is configured in pjsua2. You can do this from the project's '''Properties'''. 
     141 1. Run it. 
     142 
     143=== Log output === 
     144 
     145The pjsua2 sample application will write log messages to '''!LogCat''' window (to show !LogCat window, from Eclipse menu: '''Window''' --> '''Show View''' --> '''Other''' --> type ''!LogCat'') 
     146 
     147 
     148== Creating your own application == #create-own-app 
     149 
     150For developing Android application, you should use [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 API] whose Java interface available via SWIG Java binding. 
     151 
     152Note that this has only been tested using [http://developer.android.com/tools/help/adt.html Eclipse with ADT], however it might also be applicable for [http://developer.android.com/tools/studio/index.html Android Studio]. 
     153 
     154 1. First, build {{{pjproject}}} libraries as described above. 
     155 1. Also build {{{pjsua2 sample application}}} as described above, this step is required to generate the pjsua2 Java interface and the native library. 
     156 1. Create Android application outside the PJSIP sources for your project. 
     157 1. Get pjsua2 Java interface and native library from pjsua2 sample application: 
     158    1. Copy pjsua2 Java interface files from {{{pjsip-apps/src/swig/java/android/src}}} to your project's {{{src}}} folder: 
     159       {{{ 
     160$ cd $YOUR_PROJECT_DIR 
     161$ cp -r $PJSIP_DIR/pjsip-apps/src/swig/java/android/src . 
     162 
     163# Cleanup excess pjsua2 application sources. 
     164$ rm -r src/org/pjsip/pjsua2/app 
     165       }}} 
     166    1. Copy native library {{{libpjsua2.so}}} from {{{pjsip-apps/src/swig/java/android/libs}}} to your project's {{{libs}}} folder: 
     167       {{{ 
     168$ cd $YOUR_PROJECT_DIR 
     169$ cp -r $PJSIP_DIR/pjsip-apps/src/swig/java/android/libs . 
     170       }}} 
     171 1. Start writing your application, please check [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 docs] for reference. 
     172 
     173 
     174== Pjsua application with telnet interface == #pjsua 
     175 
     176There is also the usual [http://www.pjsip.org/pjsua.htm pjsua] with telnet command line user interface, which is located under {{{pjsip-apps/src/pjsua/android}}}. It is not built by default and you need [http://www.swig.org/download.html SWIG] to build it. Application flow and user interface are handled mainly in the native level, so it doesn't use pjsua2 API with Java interface. 
    125177 
    126178Follow these steps to build pjsua: 
     
    142194 
    143195 
    144 == Building and running pjsua2 sample application == #pjsua2 
    145  
    146 Another sample application, which is based on [https://trac.pjsip.org/repos/ticket/1519 pjsua2 high-level API] with SWIG binding, is located under {{{pjsip-apps/src/swig/java/android}}}. It is not built by default, and you need [http://www.swig.org/download.html SWIG] to build it. 
    147  
    148 Follow these steps to build pjsua2 sample application: 
    149  1. Make sure SWIG is in the build environment PATH. 
    150  1. Run {{{make}}} from directory {{{$PJDIR/pjsip-apps/src/swig}}} (note that the Android NDK root should be in the PATH), e.g: 
    151      {{{ 
    152 $ cd /path/to/your/pjsip/dir 
    153 $ cd pjsip-apps/src/swig 
    154 $ make 
    155      }}} 
    156  1. Make sure any library dependencies are copied to {{{$PJDIR/pjsip-apps/src/swig/java/android/libs/armeabi}}}, e.g: {{{libyuv.so & libopenh264.so}}} for video support. 
    157  1. Create Android project from pjsua. In Eclipse: 
    158     a. From menu: '''File''' --> '''New''' --> '''Project''' 
    159     a. Select '''Android Project from Existing Code''', press '''Next''' 
    160     a. In ''Root Directory'', put the location of '''pjsua2''' source code (i.e. {{{$PJDIR/pjsip-apps/src/swig/java/android}}}) and press '''Finish''' 
    161  1. You may need to select different Android SDK than what is configured in pjsua2. You can do this from the project's '''Properties'''. 
    162  1. Run it. 
    163  
    164 === Log output === 
    165  
    166 The pjsua2 sample application will write log messages to '''!LogCat''' window (to show !LogCat window, from Eclipse menu: '''Window''' --> '''Show View''' --> '''Other''' --> type ''!LogCat'') 
    167  
    168  
    169 == Using pjsua2 for developing your own application == #create-own-app 
    170  
    171 Note that this has only been tested using [http://developer.android.com/tools/help/adt.html Eclipse with ADT], however it might also be applicable for [http://developer.android.com/tools/studio/index.html Android Studio]. 
    172  
    173  1. First, build {{{pjproject}}} libraries as described above. 
    174  1. Also build {{{pjsua2 sample application}}} as described above, this step is required to generate the pjsua2 Java interface and the native library. 
    175  1. Create Android application outside the PJSIP sources for your project. 
    176  1. Get pjsua2 Java interface and native library from pjsua2 sample application: 
    177     1. Copy pjsua2 Java interface files from {{{pjsip-apps/src/swig/java/android/src}}} to your project's {{{src}}} folder: 
    178        {{{ 
    179 $ cd $YOUR_PROJECT_DIR 
    180 $ cp -r $PJSIP_DIR/pjsip-apps/src/swig/java/android/src . 
    181  
    182 # Cleanup excess pjsua2 application sources. 
    183 $ rm -r src/org/pjsip/pjsua2/app 
    184        }}} 
    185     1. Copy native library {{{libpjsua2.so}}} from {{{pjsip-apps/src/swig/java/android/libs}}} to your project's {{{libs}}} folder: 
    186        {{{ 
    187 $ cd $YOUR_PROJECT_DIR 
    188 $ cp -r $PJSIP_DIR/pjsip-apps/src/swig/java/android/libs . 
    189        }}} 
    190  1. Start writing your application, please check [http://www.pjsip.org/docs/book-latest/html/index.html pjsua2 docs] for reference. 
    191  
    192  
    193196== Debugging native code with Eclipse == #debug-native 
    194197