SlideShare una empresa de Scribd logo
1 de 15
Descargar para leer sin conexión
Contextual Voice/Communication
as an App or App-Feature
C. Enrique Ortiz
http://CEnriqueOrtiz.com
July 12, 2013
Google Dev Fest 2013
Revised Feb 2015
(Enabling Voice on Android Apps)
Evolution of Voice on Mobile (1)
•  Mobile has truly gone through a period of
tremendous evolution and growth
– Voice has always been a fundamental feature
of the mobile phone, and it will always be
•  Yet in the world or era of “data”, voice has been
treated as “legacy stuff”, separate and driven by
its own experience, drivers, and infrastructure;
voice just works, but separate, under Operator
control
Evolution of Voice on Mobile (2)
•  Voice is slowly becoming a “data app” — Voice
as an app or an app-feature
•  Multi-model user experience
•  These are based on SIP and WebRTC stacks &
clients that you can download and use, point-to-
point or via the old PSTN
•  The move to all IP wireless networks (LTE)
translates to ease of adapting Voice on your
app.
Voice and Apps -- Use Cases
•  The Telephone Number as Personas
–  One device, multiple Personas
–  Private/Personal vs. Public or Work/Business
–  Voice or communication as an app feature
–  Associating a telephone number to app/service(s)
•  Enhancing the call experience
–  Adding Mobile Context to the call experience
–  Unifying communications and related services
–  Add ability to initiate, receive and control calls and
other communication
Next Gen of Communication is
Context-based
“ T h e f u t u r e o f p e r s o n a l
communications and computing
is the mobile handset. Part of
this future is the integration with
local handset capabilities and
sensors and the services on the
web (the cloud). Part of this
future is about leveraging the
hidden information found in our
actions and interactions, in our
surroundings, in our mobile
context.”
Read more at http://weblog.cenriqueortiz.com/mobile-context/
Enabling Voice on Android Apps
•  Android provides Session Initiation Protocol
(SIP) API; on Android 2.3+
•  Main classes:
– SipManager defines the SIP API (Singleton)
– SipProfile defines a SIP profile account
(server, credentials, etc)
– SipAudioCall handles an Internet audio call
over SIP
•  Also, BroadcastReceiver -- listener for incoming
calls
Requirements
•  Android 2.3 or higher
•  Must have a SIP account
•  SIP runs over a wireless data connection, so your
device must have a data connection (with a
mobile data service or Wi-Fi).
– This means that you can't test on AVD—you
can only test on a physical device.
Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cenriqueortiz.android.sip">
<application android:icon="@drawable/icon" android:label="SipDemo">
<activity android:name=".SipActivity"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver android:name=".IncomingCallReceiver" android:label="Call Receiver"/>
</application>
<uses-sdk android:minSdkVersion="9" />
<uses-permission android:name="android.permission.USE_SIP" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-feature android:name="android.hardware.sip.voip" android:required="true" />
<uses-feature android:name="android.hardware.wifi" android:required="true" />
<uses-feature android:name="android.hardware.microphone" android:required="true" />
</manifest>
Request the INTERNET and USE_SIP permissions via Manifest.
public String sipAddress = null;
public SipManager manager = null;
public SipProfile me = null;
public SipAudioCall call = null;
public IncomingCallReceiver callReceiver;
:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout...);
:
// Set up the intent filter. This will be used to fire an
// IncomingCallReceiver when someone calls the SIP address used // by this application.
IntentFilter filter = new IntentFilter();
filter.addAction("android.SipDemo.INCOMING_CALL");
callReceiver = new IncomingCallReceiver();
this.registerReceiver(callReceiver, filter);
if (manager == null) {
manager = SipManager.newInstance(this);
}
}
Initializing Set ContentView, Intent filter, get SipManager, …
try {
SipProfile.Builder builder =
new SipProfile.Builder(username, domain);
builder.setPassword(password);
builder.setOutboundProxy(outboundProxy);
builder.setPort(port);
builder.setProtocol(protocol);
builder.setSendKeepAlive(true);
me = builder.build();
Intent i = new Intent();
i.setAction("android.SipDemo.INCOMING_CALL");
PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, Intent.FILL_IN_DATA);
manager.open(me, pi, null);
manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() {
public void onRegistering(String localProfileUri) {
...
}
public void onRegistrationDone(String localProfileUri, long expiryTime) {
...
}
public void onRegistrationFailed(String localProfileUri, int errorCode,
String errorMessage) {
...
}
}
} catch (ParseException pe) {
updateStatus("Connection Error.");
} catch (SipException se) {
updateStatus("Connection error.");
}
SIP Profile, Listening for Incoming Calls
Set SIP Profile, set Incoming call intent, …
public class IncomingCallReceiver extends BroadcastReceiver {
/**
* Processes the incoming call, answers it, and hands it over to the
* Activity.
* @param context The context under which the receiver is running.
* @param intent The intent being received.
*/
@Override
public void onReceive(Context context, Intent intent) {
SipAudioCall incomingCall = null;
try {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onRinging(SipAudioCall call, SipProfile caller) {
try {
call.answerCall(30);
} catch (Exception e) {
e.printStackTrace();
}
}
};
:
:
} catch (Exception e) {
if (incomingCall != null) {
incomingCall.close();
}
}
}
}
Listening for Incoming Calls Incoming Call Receiver
Initiate Call
public SipManager manager = null;
public SipProfile me = null;
:
public void initiateCall() {
try {
SipAudioCall.Listener listener = new SipAudioCall.Listener() {
@Override
public void onCallEstablished(SipAudioCall call) {
call.startAudio();
call.setSpeakerMode(true);
call.toggleMute();
}
@Override
public void onCallEnded(SipAudioCall call) {
...
}
};
call = manager.makeAudioCall(me.getUriString(),
sipAddress, listener, 30);
}
catch (Exception e) {
...
}
}
Incoming Call Receiver
Good Practices
•  Call SipManager.isVoipSupported() to verify that
the device supports VOIP calling
•  Call SipManager.isApiSupported() to verify that
the device supports the SIP APIs.
Thank You
•  C. Enrique Ortiz
•  Email: enrique.ortiz@gmail.com
•  Twitter: @eortiz
•  Website: http://CEnriqueOrtiz.com
•  Blog: http://weblog.cenriqueortiz.com
•  Kloc: http://kloc.me/u/cenriqueortiz
About C. Enrique Ortiz
•  Long-time Mobilist who focuses new
Products, Technology & Innovation in the
areas of Mobile, Cloud platforms and APIs
•  Author: J2ME/MIDP (2001) and Android in
Action (2011) and dozens of articles and
presentations
•  Organizer of Mobile Monday Austin, Android
Dev Austin, and other

Más contenido relacionado

La actualidad más candente

Evolution of mobile technology
Evolution of mobile technology Evolution of mobile technology
Evolution of mobile technology Adnan Khan
 
Wireless Systems Congress LocalSocial
Wireless Systems Congress LocalSocialWireless Systems Congress LocalSocial
Wireless Systems Congress LocalSocialSean O'Sullivan
 
LocalSocial Overview Q409v3
LocalSocial Overview Q409v3LocalSocial Overview Q409v3
LocalSocial Overview Q409v3Sean O'Sullivan
 
AppImpact: A Framework for Mobile Technology in Behavioral Healthcare
AppImpact: A Framework for Mobile Technology in Behavioral HealthcareAppImpact: A Framework for Mobile Technology in Behavioral Healthcare
AppImpact: A Framework for Mobile Technology in Behavioral HealthcareEd Dodds
 
Device Technology - Mobile
Device Technology - MobileDevice Technology - Mobile
Device Technology - MobileAlterian
 
Secure it mobile_comms
Secure it mobile_commsSecure it mobile_comms
Secure it mobile_commswangqiang6100
 
Merchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and FloorsMerchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and FloorsMerchant360, Inc.
 
Nokia NFC Presentation
Nokia NFC PresentationNokia NFC Presentation
Nokia NFC Presentationmomobeijing
 
NFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationNFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationSven Haiges
 
LocalSocial - Indoor Location Positioning Overview
LocalSocial - Indoor Location Positioning OverviewLocalSocial - Indoor Location Positioning Overview
LocalSocial - Indoor Location Positioning OverviewSean O'Sullivan
 
A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...
A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...
A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...pharmaindexing
 

La actualidad más candente (20)

Mobile Technology
Mobile TechnologyMobile Technology
Mobile Technology
 
Evolution of mobile technology
Evolution of mobile technology Evolution of mobile technology
Evolution of mobile technology
 
Overview of LocalSocial
Overview of LocalSocialOverview of LocalSocial
Overview of LocalSocial
 
Wireless Systems Congress LocalSocial
Wireless Systems Congress LocalSocialWireless Systems Congress LocalSocial
Wireless Systems Congress LocalSocial
 
Mobile Computing
Mobile ComputingMobile Computing
Mobile Computing
 
Unit 1
Unit 1Unit 1
Unit 1
 
LocalSocial Overview Q409v3
LocalSocial Overview Q409v3LocalSocial Overview Q409v3
LocalSocial Overview Q409v3
 
AppImpact: A Framework for Mobile Technology in Behavioral Healthcare
AppImpact: A Framework for Mobile Technology in Behavioral HealthcareAppImpact: A Framework for Mobile Technology in Behavioral Healthcare
AppImpact: A Framework for Mobile Technology in Behavioral Healthcare
 
Device Technology - Mobile
Device Technology - MobileDevice Technology - Mobile
Device Technology - Mobile
 
Secure it mobile_comms
Secure it mobile_commsSecure it mobile_comms
Secure it mobile_comms
 
Merchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and FloorsMerchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
 
Nokia NFC Presentation
Nokia NFC PresentationNokia NFC Presentation
Nokia NFC Presentation
 
Presentation1
Presentation1Presentation1
Presentation1
 
NFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationNFC on Android - Near Field Communication
NFC on Android - Near Field Communication
 
SMART PHONE
SMART PHONE SMART PHONE
SMART PHONE
 
LocalSocial - Indoor Location Positioning Overview
LocalSocial - Indoor Location Positioning OverviewLocalSocial - Indoor Location Positioning Overview
LocalSocial - Indoor Location Positioning Overview
 
Mobile technology
Mobile technologyMobile technology
Mobile technology
 
Mobile devices
Mobile devicesMobile devices
Mobile devices
 
A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...
A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...
A STUDY ON LOCATION-AWARE AND SAFER CARDS: ENHANCING RFID SECURITY AND PRIVAC...
 
Rococo Software Q3 2010
Rococo Software Q3 2010Rococo Software Q3 2010
Rococo Software Q3 2010
 

Similar a Contextual Voice/Communications as an App or App Feature (on Android)

Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013Blueinfy Solutions
 
Outsmarting smartphones
Outsmarting smartphonesOutsmarting smartphones
Outsmarting smartphonesSensePost
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating systemClément Escoffier
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Sujee Maniyam
 
Macronimous web solutions
Macronimous web solutionsMacronimous web solutions
Macronimous web solutionsPromoteFirst
 
An Intro to Macronimous
An Intro to Macronimous An Intro to Macronimous
An Intro to Macronimous Macronimous
 
Mobile Enterprise Application Platform
Mobile Enterprise Application PlatformMobile Enterprise Application Platform
Mobile Enterprise Application PlatformNugroho Gito
 
What's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkWhat's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkSam Basu
 
Review of SIP based DoS attacks
Review of SIP based DoS attacksReview of SIP based DoS attacks
Review of SIP based DoS attacksEditor IJCATR
 
Gnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 yearsGnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 yearsGnana Bocha
 
Analysis of VoIP Forensics with Digital Evidence Procedure
Analysis of VoIP Forensics with Digital Evidence ProcedureAnalysis of VoIP Forensics with Digital Evidence Procedure
Analysis of VoIP Forensics with Digital Evidence Procedureijsrd.com
 
UplinQ - qualcomm® smart gateway the home network as a development platform
UplinQ - qualcomm® smart gateway the home network as a development platformUplinQ - qualcomm® smart gateway the home network as a development platform
UplinQ - qualcomm® smart gateway the home network as a development platformSatya Harish
 
Otra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefoníaOtra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefoníaMartin Perez
 
iOS-Application-Security-iAmPr3m
iOS-Application-Security-iAmPr3miOS-Application-Security-iAmPr3m
iOS-Application-Security-iAmPr3mPrem Kumar (OSCP)
 
SIPifying OSGi - M Ma
SIPifying OSGi - M MaSIPifying OSGi - M Ma
SIPifying OSGi - M Mamfrancis
 
Windows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewWindows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewSascha Corti
 
Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)ClubHack
 
FIWARE IoT Proposal & Community
FIWARE IoT Proposal & CommunityFIWARE IoT Proposal & Community
FIWARE IoT Proposal & CommunityFIWARE
 

Similar a Contextual Voice/Communications as an App or App Feature (on Android) (20)

Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013Mobile code mining for discovery and exploits nullcongoa2013
Mobile code mining for discovery and exploits nullcongoa2013
 
Scall
ScallScall
Scall
 
Outsmarting smartphones
Outsmarting smartphonesOutsmarting smartphones
Outsmarting smartphones
 
Android : a linux-based mobile operating system
Android : a linux-based mobile operating systemAndroid : a linux-based mobile operating system
Android : a linux-based mobile operating system
 
01 introduction
01 introduction01 introduction
01 introduction
 
Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)Iphone client-server app with Rails backend (v3)
Iphone client-server app with Rails backend (v3)
 
Macronimous web solutions
Macronimous web solutionsMacronimous web solutions
Macronimous web solutions
 
An Intro to Macronimous
An Intro to Macronimous An Intro to Macronimous
An Intro to Macronimous
 
Mobile Enterprise Application Platform
Mobile Enterprise Application PlatformMobile Enterprise Application Platform
Mobile Enterprise Application Platform
 
What's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon TalkWhat's New with Windows Phone - FoxCon Talk
What's New with Windows Phone - FoxCon Talk
 
Review of SIP based DoS attacks
Review of SIP based DoS attacksReview of SIP based DoS attacks
Review of SIP based DoS attacks
 
Gnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 yearsGnana Prasuna B_5.5 years
Gnana Prasuna B_5.5 years
 
Analysis of VoIP Forensics with Digital Evidence Procedure
Analysis of VoIP Forensics with Digital Evidence ProcedureAnalysis of VoIP Forensics with Digital Evidence Procedure
Analysis of VoIP Forensics with Digital Evidence Procedure
 
UplinQ - qualcomm® smart gateway the home network as a development platform
UplinQ - qualcomm® smart gateway the home network as a development platformUplinQ - qualcomm® smart gateway the home network as a development platform
UplinQ - qualcomm® smart gateway the home network as a development platform
 
Otra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefoníaOtra forma de hacer aplicaciones de telefonía
Otra forma de hacer aplicaciones de telefonía
 
iOS-Application-Security-iAmPr3m
iOS-Application-Security-iAmPr3miOS-Application-Security-iAmPr3m
iOS-Application-Security-iAmPr3m
 
SIPifying OSGi - M Ma
SIPifying OSGi - M MaSIPifying OSGi - M Ma
SIPifying OSGi - M Ma
 
Windows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewWindows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's New
 
Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)Pentesting Mobile Applications (Prashant Verma)
Pentesting Mobile Applications (Prashant Verma)
 
FIWARE IoT Proposal & Community
FIWARE IoT Proposal & CommunityFIWARE IoT Proposal & Community
FIWARE IoT Proposal & Community
 

Más de Carlos Enrique Ortiz

Building and running a Data and AI-driven news-media organization(c enrique-o...
Building and running a Data and AI-driven news-media organization(c enrique-o...Building and running a Data and AI-driven news-media organization(c enrique-o...
Building and running a Data and AI-driven news-media organization(c enrique-o...Carlos Enrique Ortiz
 
Media publishing transformation in the digital era (digitalworks.ai nov2018)
Media publishing transformation in the digital era (digitalworks.ai nov2018)Media publishing transformation in the digital era (digitalworks.ai nov2018)
Media publishing transformation in the digital era (digitalworks.ai nov2018)Carlos Enrique Ortiz
 
Mobile Real-time Physical and Web Interactions
Mobile Real-time Physical and Web InteractionsMobile Real-time Physical and Web Interactions
Mobile Real-time Physical and Web InteractionsCarlos Enrique Ortiz
 
Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...
Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...
Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...Carlos Enrique Ortiz
 
Mobility, Context, Interactions and Data
Mobility, Context, Interactions and DataMobility, Context, Interactions and Data
Mobility, Context, Interactions and DataCarlos Enrique Ortiz
 

Más de Carlos Enrique Ortiz (7)

Building and running a Data and AI-driven news-media organization(c enrique-o...
Building and running a Data and AI-driven news-media organization(c enrique-o...Building and running a Data and AI-driven news-media organization(c enrique-o...
Building and running a Data and AI-driven news-media organization(c enrique-o...
 
Media publishing transformation in the digital era (digitalworks.ai nov2018)
Media publishing transformation in the digital era (digitalworks.ai nov2018)Media publishing transformation in the digital era (digitalworks.ai nov2018)
Media publishing transformation in the digital era (digitalworks.ai nov2018)
 
Mobile Real-time Physical and Web Interactions
Mobile Real-time Physical and Web InteractionsMobile Real-time Physical and Web Interactions
Mobile Real-time Physical and Web Interactions
 
Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...
Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...
Concepts And Technologies Behind Real-Time Demand Data - A Consumer, Mobile, ...
 
SIM Card Overview
SIM Card OverviewSIM Card Overview
SIM Card Overview
 
NFC In Mobile Commerce
NFC In Mobile CommerceNFC In Mobile Commerce
NFC In Mobile Commerce
 
Mobility, Context, Interactions and Data
Mobility, Context, Interactions and DataMobility, Context, Interactions and Data
Mobility, Context, Interactions and Data
 

Último

Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312wphillips114
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsChandrakantDivate1
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...nishasame66
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsChandrakantDivate1
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesChandrakantDivate1
 

Último (6)

Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 

Contextual Voice/Communications as an App or App Feature (on Android)

  • 1. Contextual Voice/Communication as an App or App-Feature C. Enrique Ortiz http://CEnriqueOrtiz.com July 12, 2013 Google Dev Fest 2013 Revised Feb 2015 (Enabling Voice on Android Apps)
  • 2. Evolution of Voice on Mobile (1) •  Mobile has truly gone through a period of tremendous evolution and growth – Voice has always been a fundamental feature of the mobile phone, and it will always be •  Yet in the world or era of “data”, voice has been treated as “legacy stuff”, separate and driven by its own experience, drivers, and infrastructure; voice just works, but separate, under Operator control
  • 3. Evolution of Voice on Mobile (2) •  Voice is slowly becoming a “data app” — Voice as an app or an app-feature •  Multi-model user experience •  These are based on SIP and WebRTC stacks & clients that you can download and use, point-to- point or via the old PSTN •  The move to all IP wireless networks (LTE) translates to ease of adapting Voice on your app.
  • 4. Voice and Apps -- Use Cases •  The Telephone Number as Personas –  One device, multiple Personas –  Private/Personal vs. Public or Work/Business –  Voice or communication as an app feature –  Associating a telephone number to app/service(s) •  Enhancing the call experience –  Adding Mobile Context to the call experience –  Unifying communications and related services –  Add ability to initiate, receive and control calls and other communication
  • 5. Next Gen of Communication is Context-based “ T h e f u t u r e o f p e r s o n a l communications and computing is the mobile handset. Part of this future is the integration with local handset capabilities and sensors and the services on the web (the cloud). Part of this future is about leveraging the hidden information found in our actions and interactions, in our surroundings, in our mobile context.” Read more at http://weblog.cenriqueortiz.com/mobile-context/
  • 6. Enabling Voice on Android Apps •  Android provides Session Initiation Protocol (SIP) API; on Android 2.3+ •  Main classes: – SipManager defines the SIP API (Singleton) – SipProfile defines a SIP profile account (server, credentials, etc) – SipAudioCall handles an Internet audio call over SIP •  Also, BroadcastReceiver -- listener for incoming calls
  • 7. Requirements •  Android 2.3 or higher •  Must have a SIP account •  SIP runs over a wireless data connection, so your device must have a data connection (with a mobile data service or Wi-Fi). – This means that you can't test on AVD—you can only test on a physical device.
  • 8. Manifest <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.cenriqueortiz.android.sip"> <application android:icon="@drawable/icon" android:label="SipDemo"> <activity android:name=".SipActivity" android:configChanges="orientation|keyboardHidden"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <receiver android:name=".IncomingCallReceiver" android:label="Call Receiver"/> </application> <uses-sdk android:minSdkVersion="9" /> <uses-permission android:name="android.permission.USE_SIP" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-feature android:name="android.hardware.sip.voip" android:required="true" /> <uses-feature android:name="android.hardware.wifi" android:required="true" /> <uses-feature android:name="android.hardware.microphone" android:required="true" /> </manifest> Request the INTERNET and USE_SIP permissions via Manifest.
  • 9. public String sipAddress = null; public SipManager manager = null; public SipProfile me = null; public SipAudioCall call = null; public IncomingCallReceiver callReceiver; : @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout...); : // Set up the intent filter. This will be used to fire an // IncomingCallReceiver when someone calls the SIP address used // by this application. IntentFilter filter = new IntentFilter(); filter.addAction("android.SipDemo.INCOMING_CALL"); callReceiver = new IncomingCallReceiver(); this.registerReceiver(callReceiver, filter); if (manager == null) { manager = SipManager.newInstance(this); } } Initializing Set ContentView, Intent filter, get SipManager, …
  • 10. try { SipProfile.Builder builder = new SipProfile.Builder(username, domain); builder.setPassword(password); builder.setOutboundProxy(outboundProxy); builder.setPort(port); builder.setProtocol(protocol); builder.setSendKeepAlive(true); me = builder.build(); Intent i = new Intent(); i.setAction("android.SipDemo.INCOMING_CALL"); PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, Intent.FILL_IN_DATA); manager.open(me, pi, null); manager.setRegistrationListener(me.getUriString(), new SipRegistrationListener() { public void onRegistering(String localProfileUri) { ... } public void onRegistrationDone(String localProfileUri, long expiryTime) { ... } public void onRegistrationFailed(String localProfileUri, int errorCode, String errorMessage) { ... } } } catch (ParseException pe) { updateStatus("Connection Error."); } catch (SipException se) { updateStatus("Connection error."); } SIP Profile, Listening for Incoming Calls Set SIP Profile, set Incoming call intent, …
  • 11. public class IncomingCallReceiver extends BroadcastReceiver { /** * Processes the incoming call, answers it, and hands it over to the * Activity. * @param context The context under which the receiver is running. * @param intent The intent being received. */ @Override public void onReceive(Context context, Intent intent) { SipAudioCall incomingCall = null; try { SipAudioCall.Listener listener = new SipAudioCall.Listener() { @Override public void onRinging(SipAudioCall call, SipProfile caller) { try { call.answerCall(30); } catch (Exception e) { e.printStackTrace(); } } }; : : } catch (Exception e) { if (incomingCall != null) { incomingCall.close(); } } } } Listening for Incoming Calls Incoming Call Receiver
  • 12. Initiate Call public SipManager manager = null; public SipProfile me = null; : public void initiateCall() { try { SipAudioCall.Listener listener = new SipAudioCall.Listener() { @Override public void onCallEstablished(SipAudioCall call) { call.startAudio(); call.setSpeakerMode(true); call.toggleMute(); } @Override public void onCallEnded(SipAudioCall call) { ... } }; call = manager.makeAudioCall(me.getUriString(), sipAddress, listener, 30); } catch (Exception e) { ... } } Incoming Call Receiver
  • 13. Good Practices •  Call SipManager.isVoipSupported() to verify that the device supports VOIP calling •  Call SipManager.isApiSupported() to verify that the device supports the SIP APIs.
  • 14. Thank You •  C. Enrique Ortiz •  Email: enrique.ortiz@gmail.com •  Twitter: @eortiz •  Website: http://CEnriqueOrtiz.com •  Blog: http://weblog.cenriqueortiz.com •  Kloc: http://kloc.me/u/cenriqueortiz
  • 15. About C. Enrique Ortiz •  Long-time Mobilist who focuses new Products, Technology & Innovation in the areas of Mobile, Cloud platforms and APIs •  Author: J2ME/MIDP (2001) and Android in Action (2011) and dozens of articles and presentations •  Organizer of Mobile Monday Austin, Android Dev Austin, and other