SlideShare una empresa de Scribd logo
1 de 40
Descargar para leer sin conexión
Augmented-smartphone
using the Android device beyond the display to
interact with the surroundings

DroidCon Italy - Turin - February 2014 - Stefano Sanna - Open Reply
Agenda
•

The company, the team and the speaker


•

Forget the augmented-reality!

•

Domains: when, where, what


•

Conclusions

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
The company
•

Reply is today a leading IT Services Company

•

Founded in 1996 by a group of Italian IT Executives now
operates in Italy, Germany, UK, Benelux, USA and Brasil.

•

+4000 employees

•

+400M€ revenues 2013/Q3 (+12% 2012/Q3)


•

Open Reply is the company of Reply Group focused on
open source software, multichannel web solutions and
mobile applications
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Open Reply and the Android Lab
•

Based in Rome, Open Reply’s Android Lab is a young team
of over 20 engineers 100% focused on Android
development

•

We are specialised in broadcasting, banking and OS
customisation

•

I’m the head of Android Lab

My adventure on mobile world began in 1999 (PSION 5MX!)
and I did my journey through Symbian, JME, iOS and
Android. I wrote two books about JME and advanced
Android programming.
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Android: numbers, please!
•

+1 Billion activations

•

+1 Million apps in the Play Store

•

2008

+50 Billions apps downloaded

2013

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Augmented Reality

Credits: http://alexcalic.com/2010/06/16/the-new-commerce-opportunities-in-the-current-wave-of-innovation/

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Augmented smartphone? :-)
•

To date, it seems that just proximity and light sensors are
always used to enhance application behaviour

•

More recently, pervasiveness of location services provide
“geo-referencing” for incoming data (web search, weather,
news)


•

Is there something more we can do to make our
applications more reactive to the environment? Can we
adapt UI and features according to user context?

•

“Yes, we can!” 

It’s time to “augment the smartphone”
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Domains

WHEN

WHAT

WHERE

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Domains

WHEN

WHAT

WHERE

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
When
•

Time is a key and quite “absolute” context information
about
•

•

Is day time? Is night time? Is today bank holiday?

Overnight
•

Use a white-on-black color schema for layouts

•

Disable sounds

•

Skip “unless” notification

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Changing behaviour overnight
You may change the layout according to current time:

•

public void onCreate(Bundle savedInstanceData) {

!

super.onCreate(savedInstanceState);

if (isNight()) {
setContentView(R.layout.main_night);
} else {
setContentView(R.layout.main_day);
}

}

•

May work, but it is annoying for the developer

•

Could be restricted for key features (e.g., text reader)

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Changing behaviour overnight
Could be better to work with themes, using a specific layout
(night vs day) only when strictly needed:

•

public void onCreate(Bundle savedInstanceData) {
super.onCreate(savedInstanceState);


!

if (isNight()) {
setTheme(R.style.Theme_Night);
} else {
setTheme(R.style.Theme_Day);
}


!

setContentView(R.layout.main);
}

•

However, you still have to:
•

Manually select other type of resources (e.g., constants, dimensions…)

•

Decide what “isNight()” means…
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Let’s Android work for us!
•

Android offers a system-level support for automatically
switching app behaviour according to time

•

The UIMode API let applications react to device plugged on
desktop stand or car dock or app running on a television

UiModeManager uiManager = (UiModeManager) 

context.getSystemService(Context.UI_MODE_SERVICE);
int uiMode = uiManager.getCurrentModeType();

!
// modes: NORMAL, DESK, CAR, APPLIANCE
if (uiManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) {
// change behaviour
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Domains

WHEN

WHAT

WHERE

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
What
•

Quite hard to determine without explicit user input
•

•

Is he at work? Is he busy? Is he driving a car?

Current your activity has direct impact on
•

Can the app throw notifications?

•

Are sounds permitted?

•

May the user be disturbed or distracted?

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
User’s activity recognition
•

Google’s Location API provides an optimised (low-power)
service that periodically detects user’s activity and notifies
updates to registered applications

•

The “DetectedActivity” is given with a certain level of
confidence and can match one the following:
•

Still

•

On foot

•

In vehicle

•

Tilting

•

Unknown
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
How it works

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Initialisation, connection & registration
public class YourActivity implements ConnectionCallbacks, OnConnectionFailedListener {
private ActivityRecognitionClient mRecognitionClient;
private PendingIntent mPendingIntent;

!
protected onCreate(Bundle savedInstanceState) {
mRecognitionClient = new ActivityRecognitionClient(mContext, this, this);
Intent intent = new Intent(mContext, YourIntentService.class);
mPendingIntent = PendingIntent.getService(mContext, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);

}

public void onStart() {
// could be elsewhere, driven by user input
mRecognitionClient.connect();
}

public void onConnected(Bundle dataBundle) {
mRecognitionClient.requestActivityUpdates(DETECTION_INTERVAL, mPendingIntent);
mRecognitionClient.disconnect();
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Event handling
!
public class ActivityRecognitionIntentService extends IntentService {

!
protected void onHandleIntent(Intent intent) {
if (ActivityRecognitionResult.hasResult(intent)) {

!
ActivityRecognitionResult result =
ActivityRecognitionResult.extractResult(intent);

!
DetectedActivity mostProbableActivity = result.getMostProbableActivity();


!

int confidence = mostProbableActivity.getConfidence();
int activityType = mostProbableActivity.getType();

!
// now you know what most likely the user is doing!
}
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Moving deeper
•

Now we know if the user is “in vehicle”, “on foot” or “still”


•

Can we go further? Can we “guess” if the user is driving his
car or he is a passenger of a public bus? Can we “guess” if
the user can be disturbed when the device is flagged as
“still”?


•

Probably we can ;-)

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Is the user driving his car?
•

Probably yes, if the smartphone has been connected to a
handsfree (not headset!) audio system:

mReceiver = new ConnectionBroadcastReceiver();
IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
registerReceiver(mReceiver, filter);

private class ConnectionBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) {
Bundle extras = intent.getExtras();
BluetoothDevice device = extras.getParcelable(BluetoothDevice.EXTRA_DEVICE);
int state = extras.getInt(BluetoothAdapter.EXTRA_CONNECTION_STATE);

!
if (state == BluetoothAdapter.STATE_CONNECTED
&& device.getBluetoothClass().getDeviceClass() ==
BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) {
// here we are!
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
On foot & still: can we speculate more?
•

A device standing horizontally with the screen upwards is
expected to stay on a desktop: the user is close to it,
working a PC o any other activity

•

A device standing horizontally with the back upwards
probably means that the user does not want to be
distracted by any message or signal coming from the
display

•

A device standing vertically is likely to be “dressed” by the
user, in his dress shirt or pants pockets; probably a
vibration is more preferable
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Device orientation
Z
•

Device on the desktop,
upwards: normal operation

•

Device on the desktop,
backwards: silent

•

X

Device vertical (Z-axis
orthogonal to gravity):
vibration
Y
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Handling device orientation
Don’t forget the
this broadcast
intent is not
dispatched to
your app until the
user launches its
main activity at
least once

Boot (BroadcastReceiver)

Schedule Alarm

YourIntentService

Manage Alarm
(BroadcastReceiver)

CheckOrientationService

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Check orientation (1/2)
private SensorManager mSensorManager;
private Sensor mAccelerometer, mMagnetometer;
private float[] mLastAccelerometer = new float[3];
private float[] mLastMagnetometer = new float[3];
private boolean mAccelerometerRead, mMagnetometerRead;
private float[] mRMatrix = new float[9];
private float[] mOrientation = new float[3];

Don’t forget to unregister the listener
when the service is destroyed

protected int startCommand(Intent intent, int flags, int startId) {

!
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);

!
mSensorManager.registerListener(this, mAccelerometer,
SensorManager.SENSOR_DELAY_NORMAL);
mSensorManager.registerListener(this, mMagnetometer,
SensorManager.SENSOR_DELAY_NORMAL);
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Check orientation (2/2)
public void onSensorChanged(SensorEvent event) {
if (event.sensor == mAccelerometer) {
System.arraycopy(event.values, 0, mLastAccelerometer, 0, event.values.length);
mAccelerometerRead = true;
} else if (event.sensor == mMagnetometer) {
System.arraycopy(event.values, 0, mLastMagnetometer, 0, event.values.length);
mMagnetometerRead = true;
}
if (mLastAccelerometerSet && mLastMagnetometerSet) {
SensorManager.getRotationMatrix(mRMatrix, null, mLastAccelerometer,
mLastMagnetometer);

!
SensorManager.getOrientation(mR, mOrientation);

Now you know the current
device orientation

if (Math.abs(mOrientation[2]) > 2) {
// display down
} else if (Math.abs( mOrientation[2]) < 1) {
// display up
}
stopSelf();
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Domains

WHEN

WHAT

WHERE

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Where
•

The core question of mobility: where is the user?


•

Location drives pre- and post- user input
•

Is position related to action triggered by the user? (e.g., web search)

•

Is position related to something the user will need in minutes?

•

Was previous position critical for the user?

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Outdoor: geofence
•

Geofence is a tuple (latitude, longitude, radius) that defines
a proximity area

•

Thanks to Fused Location Provider, the new Google’s
Location API provides a powerful and power-friendly
framework to get asynchronous notification on entering/
exiting to/from arbitrary geofences

•

There is a limit: max 100 geofences per app per device

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
How it works

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Initialisation
public class YourActivity implements ConnectionCallbacks, OnConnectionFailedListener,
OnAddGeofencesResultListener {
private LocationClient mLocationClient;
private PendingIntent mPendingIntent;
private Geofence mGeofence;

!
protected onCreate(Bundle savedInstanceState) {
mLocationClient = new LocationClient(mContext, this, this);

!
Intent intent = new Intent(mContext, YourIntentService.class);

!
mPendingIntent = PendingIntent.getService(mContext, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);

}

private void createGeofence() {
mGeofence = new Geofence.Builder().setCircularRegion(0, 0, 0)

.setRequestId(“gf1”)
.setTransitionTypes(Geofence.GEOFENCE_TRANSITION_DWELL)
.setExpirationDuration(Geofence.NEVER_EXPIRE).build();
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Connection & registration
private void addGeofences() {
// before adding geofences, we have to connect to the client
mLocationClient.connect();
}

public void onConnected(Bundle dataBundle) {

!
mLocationClient.addGeofences(Arrays.asList(new Geofence[] {mGeofence}),
mPendingIntent, this);

!
}

public void onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) {
if (LocationStatusCodes.SUCCESS == statusCode) {
}

// geofences have been registered!!!


mLocationClient.disconnect();
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Event handling
public class YourIntentService extends IntentService {

!
protected void onHandleIntent(Intent intent) {
if (!LocationClient.hasError(intent)) {
int transitionType = LocationClient.getGeofenceTransition(intent);

!
if (
(transitionType == Geofence.GEOFENCE_TRANSITION_ENTER)
||
(transitionType == Geofence.GEOFENCE_TRANSITION_EXIT)
) {
List <Geofence> geofences =
LocationClient.getTriggeringGeofences(intent);

!
}
}
}
}

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Indoor location & iBeacons
•

Indoor location has been a tricky and complex to
implement, especially from the hardware/infrastructure
perspective

•

The advent of Bluetooth Low 

Energy (BLE) and iBeacons 

model introduced in iOS 7 

make it possible to develop 

and deliver cheap yet 

extremely powerful proximity

driven services

•

Small (but not so stable…) hardware is available to start
trials and demos (estimote, kontakt…)
Credits: http://www.estimote.com

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Bluetooth Low Energy primer
•

Part of Bluetooth 4.0 specification devoted to low-power,
low-range, long-lasting M2M communication

•

Provides spontaneous and extremely 

fast advertising

•

Bluetooth Low Energy is natively 

supported by Android 4.3, but it can be 

considered stable only by KitKat 4.4

•

In order to support BLE, a firmware upgrade

is not enough: the hardware must provide

native support for Bluetooth 4.0 Smart Ready
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
BLE Device Discovery
BluetoothManager manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE);
adapter = manager.getAdapter();
boolean started = adapter.startLeScan(mLeScanCallback);

BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override
public void onLeScan(final BluetoothDevice device, int rssi, final byte[] scanRecord) {

!
// device: use it for opening connections
// rssi: use it to determine link quality e distance estimation
// scanRecord: use it for connection-less operations

!
}
};

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Inside the iBeacon advertising packet
Device type and discoverability (is it a
smartphone or a small sensor?
The iBeacon segment: contains proprietary identifiers, a customisable
UUID, a couple of variables and the 2’ complement of TX calibrated power 

(d4=212; 256-212= -44dBm)
02:01:1a




!cmd

Apple ID

Beacon UUID

Major & Minor

1a:ff:4c:00:02:15:b9:40:7f:30:f5:f8:46:6e:af:f9:25:55:6b:57:fe:6d:8b:dd:2c:74:d4




10:09:42:45:41:43:4f:4e:5f:44:49:5f:50:52:4f:56:41
00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

Friendly name

Device “friendly name”: there is no need to ask for human-readable name,
as in Blueooth Classic, it is “immediately” available
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
iBeacon and indoor localisation
•

Power loss (aka “path loss”) depends on distance,
frequency and objects between TX and RX
•

Raw: power decreases by the square of distance (signal = 1 / (distance^2))

•

Does not work at 2.4Ghz! :-(

•

Usually a logarithm scale is used (dB for gain/loss, dBm for
power in mW):

•

A good rough formula could be
•

distance = 10 ^ ((27,55 - (20 *LOG10(2400)) - F6)/20)

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Conclusion
•

Time, activity and location awareness improve apps ability
to better serve and help the user

•

Android offers a rich set of APIs and features to implement
smart behaviours, enhance usability, save power and time

•

While today “augmenting the smartphone” could be
considered (optional) added value to standard apps/
services, once Android will be much more pervasive
(appliances, automotive, facilities, wearables) this ability will
be a key factor to succeed

Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
Contacts
•

Corporate:
•

•

http://www.gaiareply.com

•

s.sanna AT reply.it

•

•

http://www.reply.eu

info AT reply.it

Personal
•

gerdavax AT gmail.com

•

@gerdavax

•

http://www.gerdavax.it
Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin

Más contenido relacionado

Destacado

Fundusze inwestycyjne - raport lipiec 2015 F-Trust
Fundusze inwestycyjne - raport lipiec 2015 F-TrustFundusze inwestycyjne - raport lipiec 2015 F-Trust
Fundusze inwestycyjne - raport lipiec 2015 F-TrustF-Trust SA
 
Introduction to VBPprofiles (Quick Guide)
Introduction to VBPprofiles (Quick Guide)Introduction to VBPprofiles (Quick Guide)
Introduction to VBPprofiles (Quick Guide)Dominique Butel
 
The Next Generation of Polyphthalamide
The Next Generation of PolyphthalamideThe Next Generation of Polyphthalamide
The Next Generation of PolyphthalamideMichael Kaisser
 
Kode folks press realease
Kode folks press realeaseKode folks press realease
Kode folks press realeaseAdi Milan
 
(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov fig...
(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov   fig...(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov   fig...
(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov fig...registromaestro
 

Destacado (12)

Córdoba
CórdobaCórdoba
Córdoba
 
Nosotros hotel señorio de la laguna
Nosotros hotel señorio de la lagunaNosotros hotel señorio de la laguna
Nosotros hotel señorio de la laguna
 
JobHunting
JobHuntingJobHunting
JobHunting
 
Fundusze inwestycyjne - raport lipiec 2015 F-Trust
Fundusze inwestycyjne - raport lipiec 2015 F-TrustFundusze inwestycyjne - raport lipiec 2015 F-Trust
Fundusze inwestycyjne - raport lipiec 2015 F-Trust
 
Blitz Channel manager como funciona
Blitz Channel manager como funcionaBlitz Channel manager como funciona
Blitz Channel manager como funciona
 
Teseo4telecentres es
Teseo4telecentres esTeseo4telecentres es
Teseo4telecentres es
 
Introduction to VBPprofiles (Quick Guide)
Introduction to VBPprofiles (Quick Guide)Introduction to VBPprofiles (Quick Guide)
Introduction to VBPprofiles (Quick Guide)
 
The Next Generation of Polyphthalamide
The Next Generation of PolyphthalamideThe Next Generation of Polyphthalamide
The Next Generation of Polyphthalamide
 
Anima Design
Anima DesignAnima Design
Anima Design
 
Kode folks press realease
Kode folks press realeaseKode folks press realease
Kode folks press realease
 
Vital Values
Vital ValuesVital Values
Vital Values
 
(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov fig...
(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov   fig...(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov   fig...
(Eche62) chess ebook libro scacchi echecs ajedrez schach garry kasparov fig...
 

Similar a Augmented Smartphone

Experience - Idea Team
Experience - Idea TeamExperience - Idea Team
Experience - Idea Teamguestcf53f1
 
Contextual Voice/Communications as an App or App Feature (on Android)
Contextual Voice/Communications as an App or App Feature (on Android)Contextual Voice/Communications as an App or App Feature (on Android)
Contextual Voice/Communications as an App or App Feature (on Android)Carlos Enrique Ortiz
 
Vertu's Digital Transformation
Vertu's Digital TransformationVertu's Digital Transformation
Vertu's Digital TransformationRobert Charlton
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Loïc Knuchel
 
Comprehensive IoT Development Services to Empower Your Business
Comprehensive IoT Development Services to Empower Your BusinessComprehensive IoT Development Services to Empower Your Business
Comprehensive IoT Development Services to Empower Your BusinessR-Style Lab
 
Enterprise IOT and WT Mobile App and Software Development Company
Enterprise IOT and WT Mobile App and Software Development CompanyEnterprise IOT and WT Mobile App and Software Development Company
Enterprise IOT and WT Mobile App and Software Development CompanyhytechProfessional
 
Pre-Conference Course: Wearables Workshop: UX Essentials - Phillip Likens
Pre-Conference Course: Wearables Workshop: UX Essentials - Phillip LikensPre-Conference Course: Wearables Workshop: UX Essentials - Phillip Likens
Pre-Conference Course: Wearables Workshop: UX Essentials - Phillip LikensUXPA International
 
IRJET- Smart Mirror using Virtual Voice Assistant
IRJET- Smart Mirror using Virtual Voice AssistantIRJET- Smart Mirror using Virtual Voice Assistant
IRJET- Smart Mirror using Virtual Voice AssistantIRJET Journal
 
Ambient computing at Lehigh University
Ambient computing at Lehigh UniversityAmbient computing at Lehigh University
Ambient computing at Lehigh UniversitySomesh Rahul
 
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
 
[Part 2] automation of home appliances using raspberry pi – implementation of...
[Part 2] automation of home appliances using raspberry pi – implementation of...[Part 2] automation of home appliances using raspberry pi – implementation of...
[Part 2] automation of home appliances using raspberry pi – implementation of...Azilen Technologies Pvt. Ltd.
 
Mobiuso - Keys to Sucess in Partnering with an Overseas Studio
Mobiuso - Keys to Sucess in Partnering with an Overseas StudioMobiuso - Keys to Sucess in Partnering with an Overseas Studio
Mobiuso - Keys to Sucess in Partnering with an Overseas StudioD.CAMP
 
Creadigol Solution, Creative Business with Technologies
Creadigol Solution, Creative Business with TechnologiesCreadigol Solution, Creative Business with Technologies
Creadigol Solution, Creative Business with TechnologiesPraveen Maheshwari
 
A realtime infrastructure for Android apps: Firebase may be what you need..an...
A realtime infrastructure for Android apps: Firebase may be what you need..an...A realtime infrastructure for Android apps: Firebase may be what you need..an...
A realtime infrastructure for Android apps: Firebase may be what you need..an...Alessandro Martellucci
 
Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...
Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...
Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...Salvatore Iaconesi
 

Similar a Augmented Smartphone (20)

Experience - Idea Team
Experience - Idea TeamExperience - Idea Team
Experience - Idea Team
 
Contextual Voice/Communications as an App or App Feature (on Android)
Contextual Voice/Communications as an App or App Feature (on Android)Contextual Voice/Communications as an App or App Feature (on Android)
Contextual Voice/Communications as an App or App Feature (on Android)
 
Sourabh_Sameer_Dubey_Resume
Sourabh_Sameer_Dubey_ResumeSourabh_Sameer_Dubey_Resume
Sourabh_Sameer_Dubey_Resume
 
Vertu's Digital Transformation
Vertu's Digital TransformationVertu's Digital Transformation
Vertu's Digital Transformation
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
 
Comprehensive IoT Development Services to Empower Your Business
Comprehensive IoT Development Services to Empower Your BusinessComprehensive IoT Development Services to Empower Your Business
Comprehensive IoT Development Services to Empower Your Business
 
Enterprise IOT and WT Mobile App and Software Development Company
Enterprise IOT and WT Mobile App and Software Development CompanyEnterprise IOT and WT Mobile App and Software Development Company
Enterprise IOT and WT Mobile App and Software Development Company
 
Pre-Conference Course: Wearables Workshop: UX Essentials - Phillip Likens
Pre-Conference Course: Wearables Workshop: UX Essentials - Phillip LikensPre-Conference Course: Wearables Workshop: UX Essentials - Phillip Likens
Pre-Conference Course: Wearables Workshop: UX Essentials - Phillip Likens
 
IRJET- Smart Mirror using Virtual Voice Assistant
IRJET- Smart Mirror using Virtual Voice AssistantIRJET- Smart Mirror using Virtual Voice Assistant
IRJET- Smart Mirror using Virtual Voice Assistant
 
Ambient computing at Lehigh University
Ambient computing at Lehigh UniversityAmbient computing at Lehigh University
Ambient computing at Lehigh University
 
Android Wearable App
Android Wearable AppAndroid Wearable App
Android Wearable App
 
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
 
[Part 2] automation of home appliances using raspberry pi – implementation of...
[Part 2] automation of home appliances using raspberry pi – implementation of...[Part 2] automation of home appliances using raspberry pi – implementation of...
[Part 2] automation of home appliances using raspberry pi – implementation of...
 
Mobiuso - Keys to Sucess in Partnering with an Overseas Studio
Mobiuso - Keys to Sucess in Partnering with an Overseas StudioMobiuso - Keys to Sucess in Partnering with an Overseas Studio
Mobiuso - Keys to Sucess in Partnering with an Overseas Studio
 
Ramesh iOS Profile
Ramesh iOS ProfileRamesh iOS Profile
Ramesh iOS Profile
 
Resume
ResumeResume
Resume
 
GetOne
GetOneGetOne
GetOne
 
Creadigol Solution, Creative Business with Technologies
Creadigol Solution, Creative Business with TechnologiesCreadigol Solution, Creative Business with Technologies
Creadigol Solution, Creative Business with Technologies
 
A realtime infrastructure for Android apps: Firebase may be what you need..an...
A realtime infrastructure for Android apps: Firebase may be what you need..an...A realtime infrastructure for Android apps: Firebase may be what you need..an...
A realtime infrastructure for Android apps: Firebase may be what you need..an...
 
Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...
Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...
Cross Media design scenarios: smartphones and tablets, a workshop at ISIA Des...
 

Más de Stefano Sanna

Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018Stefano Sanna
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldStefano Sanna
 
Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017 Stefano Sanna
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in actionStefano Sanna
 
Enlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TVEnlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TVStefano Sanna
 
NFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniNFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniStefano Sanna
 
Android - Programmazione Avanzata
Android -  Programmazione AvanzataAndroid -  Programmazione Avanzata
Android - Programmazione AvanzataStefano Sanna
 
HCIM08 - Mobile Applications
HCIM08 - Mobile ApplicationsHCIM08 - Mobile Applications
HCIM08 - Mobile ApplicationsStefano Sanna
 
Android & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioniAndroid & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioniStefano Sanna
 
Application Store: opportunita' e trappole
Application Store: opportunita' e trappoleApplication Store: opportunita' e trappole
Application Store: opportunita' e trappoleStefano Sanna
 
Android Bluetooth Hacking
Android Bluetooth HackingAndroid Bluetooth Hacking
Android Bluetooth HackingStefano Sanna
 
Free Software e Open Hardware
Free Software e Open HardwareFree Software e Open Hardware
Free Software e Open HardwareStefano Sanna
 
Playing with Mobile 2.0
Playing with Mobile 2.0Playing with Mobile 2.0
Playing with Mobile 2.0Stefano Sanna
 
Comunicazione Pervasiva
Comunicazione PervasivaComunicazione Pervasiva
Comunicazione PervasivaStefano Sanna
 
Introduzione alla tecnologia Sun SPOT
Introduzione alla tecnologia Sun SPOTIntroduzione alla tecnologia Sun SPOT
Introduzione alla tecnologia Sun SPOTStefano Sanna
 
Sensoristica Avanzata per Dispositivi Mobili
Sensoristica Avanzata per Dispositivi MobiliSensoristica Avanzata per Dispositivi Mobili
Sensoristica Avanzata per Dispositivi MobiliStefano Sanna
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTsStefano Sanna
 

Más de Stefano Sanna (20)

Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018Mobile Security su Android - LinuxDay 2018
Mobile Security su Android - LinuxDay 2018
 
Android Things, from mobile apps to physical world
Android Things, from mobile apps to physical worldAndroid Things, from mobile apps to physical world
Android Things, from mobile apps to physical world
 
Android Things Linux Day 2017
Android Things Linux Day 2017 Android Things Linux Day 2017
Android Things Linux Day 2017
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
Enlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TVEnlarge your screen: introducing the Google TV
Enlarge your screen: introducing the Google TV
 
Introduzione ad NFC
Introduzione ad NFCIntroduzione ad NFC
Introduzione ad NFC
 
NFC: tecnologia e applicazioni
NFC: tecnologia e applicazioniNFC: tecnologia e applicazioni
NFC: tecnologia e applicazioni
 
Android - Programmazione Avanzata
Android -  Programmazione AvanzataAndroid -  Programmazione Avanzata
Android - Programmazione Avanzata
 
HCIM08 - Mobile Applications
HCIM08 - Mobile ApplicationsHCIM08 - Mobile Applications
HCIM08 - Mobile Applications
 
Android & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioniAndroid & Bluetooth: hacking e applicazioni
Android & Bluetooth: hacking e applicazioni
 
Application Store: opportunita' e trappole
Application Store: opportunita' e trappoleApplication Store: opportunita' e trappole
Application Store: opportunita' e trappole
 
Android Bluetooth Hacking
Android Bluetooth HackingAndroid Bluetooth Hacking
Android Bluetooth Hacking
 
Android
AndroidAndroid
Android
 
Free Software e Open Hardware
Free Software e Open HardwareFree Software e Open Hardware
Free Software e Open Hardware
 
Playing with Mobile 2.0
Playing with Mobile 2.0Playing with Mobile 2.0
Playing with Mobile 2.0
 
Sun SPOT
Sun SPOTSun SPOT
Sun SPOT
 
Comunicazione Pervasiva
Comunicazione PervasivaComunicazione Pervasiva
Comunicazione Pervasiva
 
Introduzione alla tecnologia Sun SPOT
Introduzione alla tecnologia Sun SPOTIntroduzione alla tecnologia Sun SPOT
Introduzione alla tecnologia Sun SPOT
 
Sensoristica Avanzata per Dispositivi Mobili
Sensoristica Avanzata per Dispositivi MobiliSensoristica Avanzata per Dispositivi Mobili
Sensoristica Avanzata per Dispositivi Mobili
 
Introducing the Sun SPOTs
Introducing the Sun SPOTsIntroducing the Sun SPOTs
Introducing the Sun SPOTs
 

Último

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Último (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Augmented Smartphone

  • 1. Augmented-smartphone using the Android device beyond the display to interact with the surroundings DroidCon Italy - Turin - February 2014 - Stefano Sanna - Open Reply
  • 2. Agenda • The company, the team and the speaker
 • Forget the augmented-reality! • Domains: when, where, what
 • Conclusions Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 3. The company • Reply is today a leading IT Services Company • Founded in 1996 by a group of Italian IT Executives now operates in Italy, Germany, UK, Benelux, USA and Brasil. • +4000 employees • +400M€ revenues 2013/Q3 (+12% 2012/Q3)
 • Open Reply is the company of Reply Group focused on open source software, multichannel web solutions and mobile applications Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 4. Open Reply and the Android Lab • Based in Rome, Open Reply’s Android Lab is a young team of over 20 engineers 100% focused on Android development • We are specialised in broadcasting, banking and OS customisation • I’m the head of Android Lab
 My adventure on mobile world began in 1999 (PSION 5MX!) and I did my journey through Symbian, JME, iOS and Android. I wrote two books about JME and advanced Android programming. Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 5. Android: numbers, please! • +1 Billion activations • +1 Million apps in the Play Store • 2008 +50 Billions apps downloaded 2013 Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 7. Augmented smartphone? :-) • To date, it seems that just proximity and light sensors are always used to enhance application behaviour • More recently, pervasiveness of location services provide “geo-referencing” for incoming data (web search, weather, news)
 • Is there something more we can do to make our applications more reactive to the environment? Can we adapt UI and features according to user context? • “Yes, we can!” 
 It’s time to “augment the smartphone” Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 10. When • Time is a key and quite “absolute” context information about • • Is day time? Is night time? Is today bank holiday? Overnight • Use a white-on-black color schema for layouts • Disable sounds • Skip “unless” notification Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 11. Changing behaviour overnight You may change the layout according to current time: • public void onCreate(Bundle savedInstanceData) { ! super.onCreate(savedInstanceState);
 if (isNight()) { setContentView(R.layout.main_night); } else { setContentView(R.layout.main_day); } } • May work, but it is annoying for the developer • Could be restricted for key features (e.g., text reader) Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 12. Changing behaviour overnight Could be better to work with themes, using a specific layout (night vs day) only when strictly needed: • public void onCreate(Bundle savedInstanceData) { super.onCreate(savedInstanceState);
 ! if (isNight()) { setTheme(R.style.Theme_Night); } else { setTheme(R.style.Theme_Day); }
 ! setContentView(R.layout.main); } • However, you still have to: • Manually select other type of resources (e.g., constants, dimensions…) • Decide what “isNight()” means… Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 13. Let’s Android work for us! • Android offers a system-level support for automatically switching app behaviour according to time • The UIMode API let applications react to device plugged on desktop stand or car dock or app running on a television UiModeManager uiManager = (UiModeManager) 
 context.getSystemService(Context.UI_MODE_SERVICE); int uiMode = uiManager.getCurrentModeType(); ! // modes: NORMAL, DESK, CAR, APPLIANCE if (uiManager.getNightMode() == UiModeManager.MODE_NIGHT_YES) { // change behaviour } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 14. Domains WHEN WHAT WHERE Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 15. What • Quite hard to determine without explicit user input • • Is he at work? Is he busy? Is he driving a car? Current your activity has direct impact on • Can the app throw notifications? • Are sounds permitted? • May the user be disturbed or distracted? Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 16. User’s activity recognition • Google’s Location API provides an optimised (low-power) service that periodically detects user’s activity and notifies updates to registered applications • The “DetectedActivity” is given with a certain level of confidence and can match one the following: • Still • On foot • In vehicle • Tilting • Unknown Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 17. How it works Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 18. Initialisation, connection & registration public class YourActivity implements ConnectionCallbacks, OnConnectionFailedListener { private ActivityRecognitionClient mRecognitionClient; private PendingIntent mPendingIntent; ! protected onCreate(Bundle savedInstanceState) { mRecognitionClient = new ActivityRecognitionClient(mContext, this, this); Intent intent = new Intent(mContext, YourIntentService.class); mPendingIntent = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } public void onStart() { // could be elsewhere, driven by user input mRecognitionClient.connect(); } public void onConnected(Bundle dataBundle) { mRecognitionClient.requestActivityUpdates(DETECTION_INTERVAL, mPendingIntent); mRecognitionClient.disconnect(); } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 19. Event handling ! public class ActivityRecognitionIntentService extends IntentService { ! protected void onHandleIntent(Intent intent) { if (ActivityRecognitionResult.hasResult(intent)) { ! ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent); ! DetectedActivity mostProbableActivity = result.getMostProbableActivity();
 ! int confidence = mostProbableActivity.getConfidence(); int activityType = mostProbableActivity.getType(); ! // now you know what most likely the user is doing! } } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 20. Moving deeper • Now we know if the user is “in vehicle”, “on foot” or “still”
 • Can we go further? Can we “guess” if the user is driving his car or he is a passenger of a public bus? Can we “guess” if the user can be disturbed when the device is flagged as “still”?
 • Probably we can ;-) Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 21. Is the user driving his car? • Probably yes, if the smartphone has been connected to a handsfree (not headset!) audio system: mReceiver = new ConnectionBroadcastReceiver(); IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED); registerReceiver(mReceiver, filter); private class ConnectionBroadcastReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED)) { Bundle extras = intent.getExtras(); BluetoothDevice device = extras.getParcelable(BluetoothDevice.EXTRA_DEVICE); int state = extras.getInt(BluetoothAdapter.EXTRA_CONNECTION_STATE); ! if (state == BluetoothAdapter.STATE_CONNECTED && device.getBluetoothClass().getDeviceClass() == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) { // here we are! } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 22. On foot & still: can we speculate more? • A device standing horizontally with the screen upwards is expected to stay on a desktop: the user is close to it, working a PC o any other activity • A device standing horizontally with the back upwards probably means that the user does not want to be distracted by any message or signal coming from the display • A device standing vertically is likely to be “dressed” by the user, in his dress shirt or pants pockets; probably a vibration is more preferable Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 23. Device orientation Z • Device on the desktop, upwards: normal operation • Device on the desktop, backwards: silent • X Device vertical (Z-axis orthogonal to gravity): vibration Y Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 24. Handling device orientation Don’t forget the this broadcast intent is not dispatched to your app until the user launches its main activity at least once Boot (BroadcastReceiver) Schedule Alarm YourIntentService Manage Alarm (BroadcastReceiver) CheckOrientationService Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 25. Check orientation (1/2) private SensorManager mSensorManager; private Sensor mAccelerometer, mMagnetometer; private float[] mLastAccelerometer = new float[3]; private float[] mLastMagnetometer = new float[3]; private boolean mAccelerometerRead, mMagnetometerRead; private float[] mRMatrix = new float[9]; private float[] mOrientation = new float[3]; Don’t forget to unregister the listener when the service is destroyed protected int startCommand(Intent intent, int flags, int startId) { ! mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); ! mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL); mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_NORMAL); } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 26. Check orientation (2/2) public void onSensorChanged(SensorEvent event) { if (event.sensor == mAccelerometer) { System.arraycopy(event.values, 0, mLastAccelerometer, 0, event.values.length); mAccelerometerRead = true; } else if (event.sensor == mMagnetometer) { System.arraycopy(event.values, 0, mLastMagnetometer, 0, event.values.length); mMagnetometerRead = true; } if (mLastAccelerometerSet && mLastMagnetometerSet) { SensorManager.getRotationMatrix(mRMatrix, null, mLastAccelerometer, mLastMagnetometer); ! SensorManager.getOrientation(mR, mOrientation); Now you know the current device orientation if (Math.abs(mOrientation[2]) > 2) { // display down } else if (Math.abs( mOrientation[2]) < 1) { // display up } stopSelf(); } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 27. Domains WHEN WHAT WHERE Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 28. Where • The core question of mobility: where is the user?
 • Location drives pre- and post- user input • Is position related to action triggered by the user? (e.g., web search) • Is position related to something the user will need in minutes? • Was previous position critical for the user? Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 29. Outdoor: geofence • Geofence is a tuple (latitude, longitude, radius) that defines a proximity area • Thanks to Fused Location Provider, the new Google’s Location API provides a powerful and power-friendly framework to get asynchronous notification on entering/ exiting to/from arbitrary geofences • There is a limit: max 100 geofences per app per device Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 30. How it works Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 31. Initialisation public class YourActivity implements ConnectionCallbacks, OnConnectionFailedListener, OnAddGeofencesResultListener { private LocationClient mLocationClient; private PendingIntent mPendingIntent; private Geofence mGeofence; ! protected onCreate(Bundle savedInstanceState) { mLocationClient = new LocationClient(mContext, this, this); ! Intent intent = new Intent(mContext, YourIntentService.class); ! mPendingIntent = PendingIntent.getService(mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); } private void createGeofence() { mGeofence = new Geofence.Builder().setCircularRegion(0, 0, 0)
 .setRequestId(“gf1”) .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_DWELL) .setExpirationDuration(Geofence.NEVER_EXPIRE).build(); } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 32. Connection & registration private void addGeofences() { // before adding geofences, we have to connect to the client mLocationClient.connect(); } public void onConnected(Bundle dataBundle) { ! mLocationClient.addGeofences(Arrays.asList(new Geofence[] {mGeofence}), mPendingIntent, this); ! } public void onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) { if (LocationStatusCodes.SUCCESS == statusCode) { } // geofences have been registered!!!
 mLocationClient.disconnect(); } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 33. Event handling public class YourIntentService extends IntentService { ! protected void onHandleIntent(Intent intent) { if (!LocationClient.hasError(intent)) { int transitionType = LocationClient.getGeofenceTransition(intent); ! if ( (transitionType == Geofence.GEOFENCE_TRANSITION_ENTER) || (transitionType == Geofence.GEOFENCE_TRANSITION_EXIT) ) { List <Geofence> geofences = LocationClient.getTriggeringGeofences(intent); ! } } } } Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 34. Indoor location & iBeacons • Indoor location has been a tricky and complex to implement, especially from the hardware/infrastructure perspective • The advent of Bluetooth Low 
 Energy (BLE) and iBeacons 
 model introduced in iOS 7 
 make it possible to develop 
 and deliver cheap yet 
 extremely powerful proximity
 driven services • Small (but not so stable…) hardware is available to start trials and demos (estimote, kontakt…) Credits: http://www.estimote.com Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 35. Bluetooth Low Energy primer • Part of Bluetooth 4.0 specification devoted to low-power, low-range, long-lasting M2M communication • Provides spontaneous and extremely 
 fast advertising • Bluetooth Low Energy is natively 
 supported by Android 4.3, but it can be 
 considered stable only by KitKat 4.4 • In order to support BLE, a firmware upgrade
 is not enough: the hardware must provide
 native support for Bluetooth 4.0 Smart Ready Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 36. BLE Device Discovery BluetoothManager manager = (BluetoothManager) getSystemService(Context.BLUETOOTH_SERVICE); adapter = manager.getAdapter(); boolean started = adapter.startLeScan(mLeScanCallback); BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(final BluetoothDevice device, int rssi, final byte[] scanRecord) { ! // device: use it for opening connections // rssi: use it to determine link quality e distance estimation // scanRecord: use it for connection-less operations ! } }; Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 37. Inside the iBeacon advertising packet Device type and discoverability (is it a smartphone or a small sensor? The iBeacon segment: contains proprietary identifiers, a customisable UUID, a couple of variables and the 2’ complement of TX calibrated power 
 (d4=212; 256-212= -44dBm) 02:01:1a
 
 !cmd Apple ID Beacon UUID Major & Minor 1a:ff:4c:00:02:15:b9:40:7f:30:f5:f8:46:6e:af:f9:25:55:6b:57:fe:6d:8b:dd:2c:74:d4 
 
 10:09:42:45:41:43:4f:4e:5f:44:49:5f:50:52:4f:56:41 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00 Friendly name Device “friendly name”: there is no need to ask for human-readable name, as in Blueooth Classic, it is “immediately” available Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 38. iBeacon and indoor localisation • Power loss (aka “path loss”) depends on distance, frequency and objects between TX and RX • Raw: power decreases by the square of distance (signal = 1 / (distance^2)) • Does not work at 2.4Ghz! :-( • Usually a logarithm scale is used (dB for gain/loss, dBm for power in mW): • A good rough formula could be • distance = 10 ^ ((27,55 - (20 *LOG10(2400)) - F6)/20) Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 39. Conclusion • Time, activity and location awareness improve apps ability to better serve and help the user • Android offers a rich set of APIs and features to implement smart behaviours, enhance usability, save power and time • While today “augmenting the smartphone” could be considered (optional) added value to standard apps/ services, once Android will be much more pervasive (appliances, automotive, facilities, wearables) this ability will be a key factor to succeed Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin
  • 40. Contacts • Corporate: • • http://www.gaiareply.com • s.sanna AT reply.it • • http://www.reply.eu info AT reply.it Personal • gerdavax AT gmail.com • @gerdavax • http://www.gerdavax.it Augmented-Smartphone - Stefano Sanna - DroidCon IT 2014 - Turin