Sie sind auf Seite 1von 41

eSDK Solution

V100R002C01SPC200
Control User Guide(UC,
Android, Phone)

Issue 01

Date 2014-01-31

HUAWEI TECHNOLOGIES CO., LTD.


Copyright © Huawei Technologies Co., Ltd. 2014. All rights reserved.
No part of this document may be reproduced or transmitted in any form or by any means without prior
written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.
All other trademarks and trade names mentioned in this document are the property of their respective
holders.

Notice
The purchased products, services and features are stipulated by the contract made between Huawei and
the customer. All or part of the products, services and features described in this document may not be
within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,
information, and recommendations in this document are provided "AS IS" without warranties, guarantees or
representations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in the
preparation of this document to ensure accuracy of the contents, but all statements, information, and
recommendations in this document do not constitute a warranty of any kind, express or implied.

Huawei Technologies Co., Ltd.


Address: Huawei Industrial Base
Bantian, Longgang
Shenzhen 518129
People's Republic of China

Website: http://enterprise.huawei.com

Issue 01 (2014-01-31) Huawei Proprietary and Confidential i


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) About This Document

About This Document

Purpose
This document describes eSDK UC Android control, how to use the control to develop
programs, examples for using the control, and related reference information.

Product Versions
The following table lists the versions of related products.

Product Version

eSDK Solution V100R002C01SPC200


eSpace UC V200R001C03SPC100
Android Android 4.0 or later

Intended Audience
This document is intended for:
Independent software vendor (ISV) software developers

Symbol Conventions
The symbols that may be found in this document are defined as follows.

Symbol Description

Indicates an imminently hazardous situation which, if not


avoided, will result in death or serious injury.

Indicates a potentially hazardous situation which, if not


avoided, could result in death or serious injury.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential ii


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) About This Document

Symbol Description

Indicates a potentially hazardous situation which, if not


avoided, may result in minor or moderate injury.

Indicates a potentially hazardous situation which, if not


avoided, could result in equipment damage, data loss,
performance deterioration, or unanticipated results.
NOTICE is used to address practices not related to personal
injury.
Calls attention to important information, best practices and
tips.
NOTE is used to address information not related to personal
injury, equipment damage, and environment deterioration.

Change History
Changes between document issues are cumulative. The latest document issue contains all the
changes made in earlier issues.

Issue 01 (2014-01-31)
This issue is the first official release.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential iii


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) Contents

Contents

About This Document .................................................................................................................... ii


1 eSDK UC Android Control Overview ...................................................................................... 1
1.1 Overview ...................................................................................................................................................................... 1
1.2 Control Functions ......................................................................................................................................................... 2
1.3 Control Development Resources .................................................................................................................................. 2
1.3.1 Resource Types .......................................................................................................................................................... 2
1.3.2 Obtaining Development Resources ............................................................................................................................ 3

2 Programming Guide ..................................................................................................................... 4


2.1 Development Environment ........................................................................................................................................... 4
2.2 Creating an Android Project ......................................................................................................................................... 5
2.3 Loading the Control ...................................................................................................................................................... 7
2.3.1 Importing a Project .................................................................................................................................................... 7
2.3.2 Adding a Reference .................................................................................................................................................... 9
2.3.3 Modifying the Project Configuration File ................................................................................................................ 10
2.4 Invoking the Control ................................................................................................................................................... 14

3 Using the Control ........................................................................................................................ 16


3.1 Overview .................................................................................................................................................................... 16
3.2 Login and Logout Methods......................................................................................................................................... 17
3.3 Call Control ................................................................................................................................................................ 23
3.4 Conference Control ..................................................................................................................................................... 26
3.5 IM Control .................................................................................................................................................................. 29
3.6 Contact Control ........................................................................................................................................................... 32

A Acronyms and Abbreviations .................................................................................................. 35

Issue 01 (2014-01-31) Huawei Proprietary and Confidential iv


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 1 eSDK UC Android Control Overview

1 eSDK UC Android Control Overview

1.1 Overview
To enable ISVs to easily integrate UC functions into third-party applications, eSDK UC
Android control provides the call, conference, instant messaging (IM), and contact controls.
Figure 1-1 shows eSDK UC Android control architecture.

Figure 1-1 eSDK UC Android control architecture

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 1


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 1 eSDK UC Android Control Overview

1.2 Control Functions


Call Control
ISVs can integrate the call control into third-party applications so that they can integrate
eSpace call capabilities. The call control provides the click to dial (CTD), voice over IP
(VoIP), and video call functions.
CTD call
The CTD call function allows users to set the calling and called numbers. If the carrier of the
calling or called number does not provide the free-to-answer service, the calling party or
called party in a CTD call must pay call fees.
VoIP call
The VoIP call function allows users to make voice calls over IP networks.
Video call
The video call function allows users to see each other's video in a call.

Conference Control
ISVs can integrate the conference control into third-party applications so that they can
integrate eSpace capabilities of creating voice and multimedia data conferences.

IM Control
ISVs can integrate the IM control into third-party applications so that they can integrate
eSpace IM capabilities.

Contact Control
ISVs can integrate the contact control into third-party applications so that they can integrate
eSpace address book capabilities. The contact control allows ISVs to easily search the
enterprise address book.

1.3 Control Development Resources


1.3.1 Resource Types
eSDK UC Android control provides the following resources for secondary development:
 eSDK UC Android control software package
 eSDK UC Android control user guide
 eSDK UC Android control demo sample code

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 2


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 1 eSDK UC Android Control Overview

1.3.2 Obtaining Development Resources


ISV users can visit http://support.huawei.com/enterprise/ and browse or download software
and version documentation, as described in Table 1-1.

Table 1-1 Path for downloading eSDK development resources

Development Resource Download Path

Application programming Visit http://enterprise.huawei.com, and choose


interface (API) and Support > Software Downloads > Vertical Industries
configuration file Solutions > eSDK Solution > eSDK Solution.
Control user guide Visit http://enterprise.huawei.com, and choose
Support > Product Support > Vertical Industries
Solutions > eSDK Solution > eSDK Solution.
Secondary development demo Visit http://enterprise.huawei.com, and choose
sample code Support > Product Support > Vertical Industries
Solutions > eSDK Solution > eSDK Solution

If you have any problems when downloading documents or software, send emails to
enterprise_isv@huawei.com to contact Huawei customer service.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 3


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

2 Programming Guide

2.1 Development Environment


Table 2-1 provides the development environment required to use eSDK UC Android control
to develop third-party services.

Table 2-1 Development environment

Name Version

Operating system Windows 7 Professional


Android SDK Bundle 21.1.0
Android Android 4.0 or later

Before developing applications, you must obtain the mobile terminal access configuration
information provided by the eSpace UC server and UC accounts. Table 2-2 provides examples
of required information.

Table 2-2 Network account information

Network Device Value Remarks


Configuration Parameter

eSpace UC server 10.170.97.143:7801


Parameter values provided in this table
UC account 1 xx01 are examples only.

UC account number 1 143011 You can apply for UC accounts on the


eSpace UC Business Management
Platform (BMP). For details, see
UC account 2 xx02
related eSpace UC documentation.
UC account number 2 143012

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 4


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

2.2 Creating an Android Project


Step 1 Start Eclipse and choose File > New > Other. In the window for creating a project, choose
Android > Android Application Project, set Application Name and Project Name to
esdk_uc_control_android_phone_demo, and set Package Name to
com.huawei.esdk.uc.control.demo, as shown in Figure 2-1.

Figure 2-1 New Android Application window

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 5


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

Step 2 Click Next. The Android application configuration wizard window is displayed, as shown in
Figure 2-2.

Figure 2-2 Configuration wizard window

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 6


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

Step 3 Deselect Create custom launcher icon and Create Activity, and click Finish. The project is
created, as shown in Figure 2-3.

Figure 2-3 Project browsing window

----End

2.3 Loading the Control


2.3.1 Importing a Project
Decompress the eSDK UC Android control resource package
esdk_uc_control_android_phone.zip in the project directory, and import the
esdk_uc_control_android_phone_code project in Eclipse. The project is imported, as shown
in Figure 2-4.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 7


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

Figure 2-4 Control project preview

The libs directory contains all the required Java Archive (JAR) packages and .so files. The ecslib.jar file
provides basic eSpace utility classes. The eSapceService.jar file provides underlying eSpace services.
The HME-Audio.jar and HME-Video.jar files provide the audio and video codec capabilities. The
SvnApi.jar file provides Secure Sockets Layer virtual private network (SVN) security authentication
functions.
The esdk_uc_control_android_phone_code.jar file in the bin directory provides control
encapsulation.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 8


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

2.3.2 Adding a Reference


Right-click esdk_uc_control_android_phone_demo, and choose Properties. Click Add in
the library area on the Android tab page to add a reference to
esdk_uc_control_android_phone_code. The window shown in Figure 2-5 is displayed.

Figure 2-5 Reference adding window

Select esdk_uc_control_android_phone_code and click OK. The project reference


relationship is displayed in the project property window, as shown in Figure 2-6.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 9


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

Figure 2-6 Project property window

2.3.3 Modifying the Project Configuration File


Copy the permission and activity configuration items in the AndroidManifest.xml file of the
esdk_uc_control_android_phone_code project to the AndroidManifest.xml file of the
esdk_uc_control_android_phone_demo project.

Permission Configuration Items


<uses-permission android:name="android.permission.INTERNET" >
</uses-permission>
<uses-permission android:name="android.permission.BROADCAST_STICKY" >
</uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK" >
</uses-permission>
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.VIBRATE" >
</uses-permission>
<uses-permission android:name="android.permission.READ_CONTACTS" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.RECORD_AUDIO" >

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 10


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

</uses-permission>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.GET_TASKS" >
</uses-permission>
<uses-permission android:name="android.permission.CALL_PHONE" >
</uses-permission>
<uses-permission android:name="android.permission.READ_CALENDAR" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_CALENDAR" >
</uses-permission>
<uses-permission android:name="android.permission.GET_ACCOUNTS" >
</uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" >
</uses-permission>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" >
</uses-permission>
<!-- fast2.0 need bluetooth permission -->
<uses-permission android:name="android.permission.BLUETOOTH" >
</uses-permission>
<!-- camera permission -->
<uses-permission android:name="android.permission.CAMERA" >
</uses-permission>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.ACCESS_SURFACE_FLINGER" >
</uses-permission>
<!-- Customized permission. You can invoke eSpaceMobile components only after the
customized permission is added. -->
<uses-permission android:name="com.huawei.eSpaceMobileApp" />

Activity Configuration Items


<!—IM control -->
<activity
android:name="com.huawei.esdk.uc.control.im.ui.ChatActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<!-- Video call page -->
<activity
android:name="com.huawei.esdk.uc.control.call.ui.VideoActivity"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<!-- Contact details page -->
<activity
android:name="com.huawei.esdk.uc.control.contactdetail.ui.ContactDetailActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Contact page -->
<activity
android:name="com.huawei.esdk.uc.control.contacts.ui.ContactsActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Conference control--Conference list management -->

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 11


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

<activity

android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceListManageActivity
"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Conference details page -->
<activity
android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceDetailActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Page for creating conferences -->
<activity
android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceCreateActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Page for selecting time -->
<activity

android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceCreateDateActivity
"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Conference management page -->
<activity
android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceManageActivity"
android:configChanges="orientation|keyboardHidden"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<!-- Page for adding participants -->
<activity

android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceAddMemberActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Participant list page -->
<activity
android:name="com.huawei.esdk.uc.control.conference.ui.MoreAddMemberActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Conference IM page -->
<activity
android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceChatActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Conference data sharing page -->
<activity
android:name="com.huawei.esdk.uc.control.conference.ui.ConferenceShareActivity"
android:configChanges="locale"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Black.NoTitleBar" />
<!-- Contact control -->
<activity
android:name="com.huawei.esdk.uc.control.contact.ContactActivity"
android:configChanges="locale"

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 12


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

android:screenOrientation="portrait" />
<!-- Call page -->
<activity
android:name="com.huawei.esdk.uc.control.module.media.ui.MediaActivity"
android:configChanges="locale"
android:launchMode="singleTask"
android:screenOrientation="portrait" />
<!-- IM history page -->
<activity
android:name="com.huawei.esdk.uc.control.im.ui.ChatHistoryActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Black screen page during a call -->
<activity
android:name="com.huawei.esdk.uc.control.call.ui.BlackActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Dial plate control -->
<activity
android:name="com.huawei.esdk.uc.control.call.ui.DialViewActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- Page for selecting a contact -->
<activity
android:name="com.huawei.esdk.uc.control.call.ui.DialContactActivity"
android:configChanges="locale"
android:screenOrientation="portrait" />
<!-- eSpace service -->
<service android:name="com.huawei.service.eSpaceService" />

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 13


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

2.4 Invoking the Control


Figure 2-7 shows the process of invoking eSDK UC Android control.

Figure 2-7 Control invocation process

UI layout

Control initialization

Login

Dial plate
conference
Contact

Data

IM
VoIP call
CTD call

Video call

Logout

The process of invoking eSDK UC Android control involves the following operations:
 Creating a project: Use the integrated development environment (IDE) to create an
Android project and load eSDK UC Android control.
 Arranging the UI layout
Arrange the UI layout based on the project requirements, including:

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 14


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 2 Programming Guide

− Add the home page layout file (activity_main.xml) and the corresponding activity
(MainActivity).
− Declare variables for each UI element in MainActivity, set initial values for text
boxes, and set click events for buttons.
 Implementing the login function: Implement the login function to allow users to log in
to the UC server in common mode or using an SVN security gateway.
 Implementing services: Implement the call service, including initiating the dial plate
and processing CTD and VoIP calls (including video calls), contact service (video calls
can be directly initiated from the address book), data conference service, and IM service.
 Implementing the logout function: Implement the logout function to allow login users
to log out of the UC server.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 15


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

3 Using the Control

3.1 Overview
Adding the Home Page
Add the home page layout file (activity_main.xml) and the corresponding activity
(MainAcitvity) to the esdk_uc_control_android_phone_demo project. Figure 3-1 shows the
home page. For details about activity_main.xml and MainAcitvity, see the demo sample
code.

Figure 3-1 Demo home page

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 16


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

3.2 Login and Logout Methods


You can implement the login and logout functions using the logIn and logOut methods. In the
two methods, you must pass in a parameter of the Handler type to process the returned login
and logout results. The following login modes are supported:
 Common login
 Login using an SVN security gateway (For details, see the remarks.)
You must ensure that server information is configured before users can log in using an SVN
security gateway. If users do not log in using an SVN gateway, you do not need to configure
server information.

Logging In
 Class
com.huawei.esdk.uc.control.login.LoginService
 Method definition
public void logIn(String userName,String password,Handler loginHandler)
 Parameter

Parameter Type Description

userName String eSpace account.


password String eSpace login password.
loginHandler Handler Login message processing handler.

Logging Out
 Class
com.huawei.esdk.uc.control.login.LoginService
 Method definition
public void logOut(Handler logoutHandler)
 Parameter

Parameter Type Description

logoutHandler Handler Logout message processing handler.

Configuring Server Information


 Class
com.huawei.esdk.uc.control.data.selfinfo.SelfDataHandler
 Method definition
− Server IP address
SelfDataHandler.getIns().getSelfData().setServerUrl(String serverIP);

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 17


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

− Server port number


SelfDataHandler.getIns().getSelfData().setServerPort(String serverPort);
− SVN security gateway login identification
SelfDataHandler.getIns().getSelfData().setSvnFlag(isShowSvnSetting);
− IP address of the SVN security gateway
SelfDataHandler.getIns().getSelfData().setSvnIp(svnIpValue);
− Port number of the SVN security gateway
SelfDataHandler.getIns().getSelfData().setSvnPort(svnPortValue);
− SVN security gateway account
SelfDataHandler.getIns().getSelfData().setSvnAccount(svnAccountValue);
− SVN security gateway password
SelfDataHandler.getIns().getSelfData().setSvnPassword(svnPassValue);

Processing the Login Message


/**
* Login message processing handler
*/
private Handler loginHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case LoginService.LOGIN_SUCCESS: // Login succeeds.

closeDialog(); // Close the progress dialog box.


Toast.makeText(MainActivity.this, getText(R.string.label_login_success),
Toast.LENGTH_SHORT).show();

freshLoginLayout(); // Refresh the page.

break;

case LoginService.LOGIN_FAILED: // Login fails.

closeDialog(); // Close the progress dialog box.


String error_msg = (String) msg.obj; // Obtain login error information.
Toast.makeText(MainActivity.this, error_msg, Toast.LENGTH_SHORT).show();

freshLoginLayout(); // Refresh the page.

break;

default:
break;
}
}
};

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 18


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Processing the Logout Message


/**
* Logout message processing handler
*/
private Handler logoutHandler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
switch (msg.what)
{
case LoginService.LOGOUT_SUCCESS: // Logout succeeds.

Toast.makeText(MainActivity.this, getText(R.string.label_logout_success),
Toast.LENGTH_SHORT).show();

freshLoginLayout(); // Refresh the page.

closeDialog(); // Close the progress dialog box.

if(logoutForFinish){
finish();
}

break;

case LoginService.LOGOUT_FAILED: // Logout fails.

String error_msg = (String) msg.obj; // Obtain logout error information.


Toast.makeText(MainActivity.this, error_msg, Toast.LENGTH_SHORT).show();

freshLoginLayout(); // Refresh the page.


closeDialog(); // Close the progress dialog box.

if(logoutForFinish){
finish();
}

break;

default:
break;
}
}

Saving Server Address Information


/**
* Check whether the server IP address and port number are empty. Save the server
IP address and port number.
* @return
*/
private boolean checkIsEmpty() {

if("".equals(edServerIp.getText().toString().trim())){

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 19


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Toast.makeText(MainActivity.this, getText(R.string.serverblank),
Toast.LENGTH_SHORT).show();
return false;
}

if("".equals(edServerPort.getText().toString().trim())){

Toast.makeText(MainActivity.this, getText(R.string.portblank),
Toast.LENGTH_SHORT).show();
return false;
}

if("".equals(edUCAccount.getText().toString().trim()) ||
"".equals(edUCPassword.getText().toString().trim())){

Toast.makeText(MainActivity.this, getText(R.string.userorpasswrong),
Toast.LENGTH_SHORT).show();
return false;
}

// Save the server IP address and port number.

SelfDataHandler.getIns().getSelfData().setServerUrl(edServerIp.getText().toStri
ng());

SelfDataHandler.getIns().getSelfData().setServerPort(edServerPort.getText().toStrin
g());

return true;
}

Saving SVN Security Gateway Information


/**
* Save SVN security gateway information.
* @return
*/
private boolean doSvnSetting() {

// Save operation.
SelfDataHandler.getIns().getSelfData().setSvnFlag(isShowSvnSetting); // Save the
settings about whether to use an SVN security gateway.

SelfDataHandler.getIns().getSelfData().setVersion(getString(R.string.androidversion
)); // Save the Android version.
Logger.debug(LocalLog.APPTAG, "svnFlag->"+isShowSvnSetting+
"SelfDataHandler.getIns().getSelfData().setVersion
done");

if (isShowSvnSetting)
{
int resId = -1;

// Save SVN security gateway information.


String svnIpValue = svnServer.getText().toString();

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 20


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

String svnPortValue = svnPort.getText().toString();


String svnAccountValue = svnAccout.getText().toString();
String svnPassValue = svnPassword.getText().toString();

if(StringUtil.isStringEmpty(svnIpValue))
{
resId = R.string.svnipblank;
}
else if(StringUtil.isStringEmpty(svnPortValue))
{
resId = R.string.svnportblank;
}
else if(StringUtil.isStringEmpty(svnAccountValue))
{
resId = R.string.svn_account_empty_prompt;
}
else if(StringUtil.isStringEmpty(svnPassValue))
{
resId = R.string.svn_pwd_empty_prompt;
}
else if(!CommonUtil.isIPAddress(svnIpValue)
&& !CommonUtil.isDomainName(svnIpValue))
{
resId = R.string.svn_address_format_error;
}
else if(isIllegalPort(svnPortValue))
{
resId = R.string.svn_port_error;
}

if (-1 != resId)
{
Toast.makeText(MainActivity.this, getText(resId), Toast.LENGTH_SHORT).show();
return false;
}

// Save SVN security gateway information only when it is valid.


SelfDataHandler.getIns().getSelfData().setSvnIp(svnIpValue); // Save the IP
address of the SVN security gateway.
SelfDataHandler.getIns().getSelfData().setSvnPort(svnPortValue); // Save the
port number of the SVN security gateway.

SelfDataHandler.getIns().getSelfData().setSvnAccount(svnAccountValue); // Save
the SVN security gateway account.
SelfDataHandler.getIns().getSelfData().setSvnPassword(svnPassValue); // Save
the SVN security gateway password.

return true;
}

return true;
}

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 21


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Login Sample Code


/**
* Login
*/
private void login()
{
String userName = edUCAccount.getText().toString().trim();
String password = edUCPassword.getText().toString().trim();
showProgressDialog(); // Display the progress dialog box.
loginService.logIn(userName, password, loginHandler); // log in.

Logout Sample Code


/**
* Logout
*/
private void logout()
{
showProgressDialog();// Display the progress dialog box.
loginService.logOut(logoutHandler); // Log out.
}

Processing Login and Logout Click Events


case R.id.btn_login:

if(!loginService.isLogin()){ // Check whether a user has logged in.

if(checkIsEmpty() && doSvnSetting()) { // Check and save data.


login(); // Log in.
}
} else {
logout(); // Log out.
}
break;

Remarks
Before users can log in using an SVN security gateway, you must configure the following
information:
 SVN login flag
− true: Use an SVN security gateway.

− false: Do not use an SVN security gateway.


The code is as follows:
SelfDataHandler.getIns().getSelfData().setSvnFlag(true); //Configure whether to
use an SVN security gateway.
 SVN security gateway IP address, port number, account, and password
SelfDataHandler.getIns().getSelfData().setSvnIp(svnIpValue);//Configure the IP
address for the SVN security gateway.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 22


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

SelfDataHandler.getIns().getSelfData().setSvnPort(svnPortValue);//Configure the
port number for the SVN security gateway.
SelfDataHandler.getIns().getSelfData().setSvnAccount(svnAccountValue);//Configu
re the SVN security gateway account.
SelfDataHandler.getIns().getSelfData().setSvnPassword(svnPassValue);//Configure
the SVN security gateway password.

3.3 Call Control


eSpace UC Android call control is an Android activity that supports CTD and VoIP calls. VoIP
calls can be upgraded to video calls. The basic processes of the preceding call types are
similar. Therefore, all types of calls share the same UI.

Control Functions
Table 3-1 lists the functions provided by the call control.

Table 3-1 Call functions

Function Description

Initiating a CTD call N/A


Initiating a VoIP call N/A
Canceling a VoIP call N/A
Answering a VoIP call N/A
Rejecting a VoIP call N/A
Performing two-stage Perform two-stage dialing by clicking the two-stage dial
dialing plate on the CTD or VoIP call page.
Ending a VoIP call N/A
Muting/Unmuting Mute or unmute in all types of calls.
Switching among audio Switch among audio routes (including switching between
routes the wired earphone and Bluetooth earphone).
Converting a VoIP call to a Upgrade a VoIP call to a video call.
video call
Canceling a video call Stop a video call and return to a VoIP call.
Switching between the front Switch between the front and rear cameras in a video call.
and rear cameras

Invoking the Control


 Class
com.huawei.esdk.uc.control.Controls

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 23


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

 Method definition
public static boolean gotoCall(Context context, String calledNumber)
 Parameter

Parameter Type Description

context Context Context.


calledNumber String Called number, which can be null.

Adding the Call Page


Add the call page layout file (activity_call.xml) and the corresponding activity (CallAcitvity)
to the esdk_uc_control_android_phone_demo project. Figure 3-2 shows the call page. For
details about activity_call.xml and CallAcitvity, see the demo sample code.

Figure 3-2 Call control invocation page

Setting the Callback Number


You can set the callback number of a CTD call to a mobile number or UC account. By default,
the callback number is a UC account.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 24


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

 Class
com.huawei.esdk.uc.control.data.selfinfo.SelfDataHandler
 Method definition
SelfDataHandler.getIns().getSelfData().setCallbackNumber(String callbackNumber)
/**
* Set the callback number.
*/
private void setCallBackNume()
{
// Callback number.
String callbackNumber = edUcCallbackNum.getText().toString().trim();

SelfDataHandler.getIns().getSelfData().setSelfDefineCallNumber(callbackNumber);
// Set the callback number.
SelfDataHandler.getIns().getSelfData().setCallbackNumber(callbackNumber);

callbackNumL.setVisibility(View.GONE);
callbackNumCheck.setImageResource(R.drawable.icon_select_off2);
isShowCallBackSetting = false;
}

Processing Services
The code for invoking the dial plate page is as follows:
/**
* Access the dial plate.
*/
private void dialCall()
{
if(!IsLogin()) // Check whether a user has logged in.
{
return ;
}

String calledNumber = edCalledNumber.getText().toString().trim();

Controls.gotoCall(this, calledNumber); // Invoke the call control.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 25


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Figure 3-3 Dial plate page

 On the dial plate page, you can set the call type to VoIP or CTD. VoIP calls can be
upgraded to video calls.
 You must set the callback number for a CTD call, which is the UC account by default.
For details, see section "Setting the Callback Number."

3.4 Conference Control


Control Functions
eSDK UC Android conference control is an Android activity. Table 3-2 lists the functions
provided by the conference control.

Table 3-2 Conference functions

Function Description

Creating an instant conference or a Create an instant conference or a scheduled


scheduled conference conference. Conferences types include the voice
conference and multimedia conference.
Obtaining the conference list Obtain a list that contains the conferences that
have not started, ongoing conferences, and
conferences that have ended.
Adding a participant N/A

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 26


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Function Description

Removing a participant Remove a participant from a conference.


Muting/Unmuting the local microphone Mute/Unmute the local microphone during a
conference.
Switching among audio routes Switch among the handset, loudspeaker, and
earphone.
Upgrading a voice conference to a Upgrade a common voice conference to a
multimedia conference (This function is multimedia conference.
applicable only to a multimedia
conference site.)
Leaving a conference site N/A
Ending a data conference (This function N/A
is applicable only to a multimedia
conference site.)
Sending an instant message (This N/A
function is applicable only to a
multimedia conference site.)
Sending a video request (This function N/A
is applicable only to a multimedia
conference site.)
Switching between the front and rear Switch between the front and rear cameras
cameras (This function is applicable during a multimedia conference.
only to a multimedia conference site.)
Accepting the screen sharing request N/A
Accepting a conference invitation N/A
Rejecting a conference invitation N/A
Starting a data conference (classified as Start a data conference during a multimedia
a multimedia conference) conference.

Invoking the Control


 Class
com.huawei.esdk.uc.control.Controls
 Method definition
public static boolean gotoConference(Context context)
 Parameter

Parameter Type Description

context Context Context.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 27


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Adding the Conference Page


Add the conference page layout file (activity_conference.xml) and the corresponding activity
(ConferenceAcitvity) to the esdk_uc_control_android_phone_demo project. Figure 3-4 shows
the conference page. For details about activity_conference.xml and ConferenceAcitvity, see
the demo sample code.

Figure 3-4 Conference control invocation page

Processing Services
The code for invoking the conference list page is as follows:
/**
* Access the conference list.
*/
private void conferenceList()
{
if (!LoginProcess.isLoginCheck()) // Check whether a user has logged in.
{
Toast.makeText(ConferenceActivity.this, R.string.message_login_first,
0).show();
return;
}

Controls.gotoConference(this); // Invoke the conference control.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 28


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Figure 3-5 Conference list page

3.5 IM Control
Control Functions
eSDK UC Android IM control is an Android activity. Table 3-3 lists the functions provided by
the IM control.

Table 3-3 IM functions

Function Description

Sending IM text Send an instant message.


Closing the IM page Close the IM page.
Viewing the contact information Click the profile picture of the peer party on the IM
about the peer party page to view the contact information.
Receiving IM text Receive an instant message.
Receiving the status change of the Receive the status change of the peer party and
peer party update the status on the local client.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 29


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Function Description

Opening the emoticon library Open the emoticon library in the text input box to
send an emoticon.

Invoking the Control


 Class
com.huawei.esdk.uc.control.Controls
 Method definition
public static boolean gotoIM(Context context, String eSpaceNumber)
 Parameter

Parameter Type Description

context Context Context.


eSpaceNumber String eSpace UC account of the peer party.

Adding the IM Page


Add the IM page layout file (activity_im.xml) and the corresponding activity (IMAcitvity) to
the esdk_uc_control_android_phone_demo project. Figure 3-6 shows the IM page. For details
about activity_im.xml and IMAcitvity, see the demo sample code.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 30


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Figure 3-6 IM control invocation page

Processing Services
The code for invoking the IM page is as follows:
/*Respond to the click on the IM chat button.*/
private void gotoIM()
{
String eSpaceNumber = = editChatWith.getText().toString().trim();
if(!eSpaceNumber.isEmpty())
{
Controls.gotoIM(this, eSpaceNumber); // Invoke the IM control.
}

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 31


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Figure 3-7 IM page

3.6 Contact Control


Control Functions
eSDK UC Android contact control is an Android activity. Table 3-4 lists the functions
provided by the contact control.

Table 3-4 Contact functions

Function Description

Searching for a contact based on Search for a contact based on search criteria. Fuzzy
search criteria search is supported.
Viewing contact information Click to view the detailed contact information.
Receiving contact status changes Receive contact status changes
Initiating a CTD or VoIP call Initiate a CTD or VoIP call from an address book.
Initiating a video call Initiate a video call from the contact details page.
Initiating an IM chat Initiate an IM chat from an address book.

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 32


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Invoking the Control


 Class
com.huawei.esdk.uc.control.Controls
 Method definition
public static boolean gotoContact(Context context)
 Parameter

Parameter Type Description

context Context Context.

Adding the Contact Page


Add the contact page layout file (activity_contacts.xml) and the corresponding activity
(ContactsAcitvity) to the esdk_uc_control_android_phone_demo project. Figure 3-8 shows
the contact page. For details about activity_contacts.xml and ContactsAcitvity, see the demo
sample code.

Figure 3-8 Contact control invocation page

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 33


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) 3 Using the Control

Processing Services
The code for invoking the contact page is as follows:
/**
* Access the contact page.
*/
private void showContacts()
{
if(!LoginProcess.isLoginCheck()) // Check whether a user has logged in.
{
Toast.makeText(ContactsActivity.this, R.string.message_login_first,
0).show();
return ;
}
Controls.gotoContact(this); // Invoke the contact control.

Figure 3-9 Contact page

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 34


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) A Acronyms and Abbreviations

A Acronyms and Abbreviations

A
AA Authentication Authorization

B
BMP business management platform

C
CTC click to conference
CTD click to dial

E
eSDK Enterprise Software Development Kit

I
IM instant messaging
ISV independent software vendor

M
MAA mobile access agent

S
SDK software development kit
SVN Secure Sockets Layer virtual private network

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 35


Copyright © Huawei Technologies Co., Ltd.
eSDK Solution
Control User Guide(UC, Android, Phone) A Acronyms and Abbreviations

U
UC unified communications

V
VoIP voice over Internet Protocol

Issue 01 (2014-01-31) Huawei Proprietary and Confidential 36


Copyright © Huawei Technologies Co., Ltd.

Das könnte Ihnen auch gefallen