SlideShare a Scribd company logo
1 of 28
Download to read offline
SUPERIORIDAD AÉREA
EN APLICACIONES ANDROID



                  Saúl Díaz González
                     saul@tuenti.com
Wi-Fi 802.11 N




                     Near-Field Comm.


Bluetooth 3.0 + HS
“¿Cómo mejorarlo? Le pondremos Bluetooth. ¡Todo es mejor
con Bluetooth!”
                                        -Sheldon Cooper
Búsqueda


Descubrimiento


   Conectar


   Aceptar




¡Emparejados!
Clases clave

               Descubrir
Bluetooth                  Bluetooth
 Adapter                    Device



                           Bluetooth
Crear




                            Adapter



               Conectar    Bluetooth
Bluetooth
                Aceptar     Server
 Socket
                            Socket
Activando el Bluetooth
                  BLUETOOTH
               BLUETOOTH_ADMIN




      mBtAdapter =
         BluetoothAdapter.getDefaultAdapter();




                mBtAdapter == null?


                           Si

Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(intent, REQUEST_ENABLE_BT);
Descubrimiento
           Cliente                             Servidor
                                   Intent(BluetoothAdapter.
  mBtAdapter.startDiscovery();          ACTION_REQUEST_DISCOVERABLE);
                                   Intent.putExtra(BluetoothAdapter.
                                        EXTRA_DISCOVERABLE_DURATION,
                                        300);

   IntentFilter(BluetoothDevice.
        ACTION_FOUND);
   registerReceiver(mReceiver,
                filter);



     intent.getParcelableExtra(
BluetoothDevice.EXTRA_DEVICE);
Conexión
            Cliente                                                 Servidor

btDevice.                                          mBtAdapter.
    createRfcommSocketToServiceRecord(                 listenUsingRfcommWithServiceRecord(NAME,
    MY_UUID);                                          MY_UUID);




       clientSocket.connect();                                 serverSocket.accept();




                       in = socket.getInputStream();
                       out = socket.getOutputStream();
                       in.read(buffer) //Buffer is byte[]
                       out.write(buffer)
“Cualquier tecnología lo suficientemente avanzada es
indistinguible de la magia”
                                           -Arthur C. Clarke
NFC Tag

Write                  Read




        Android Beam
NFC Data Exchange Format (NDEF)



Record1             Record2      ...       RecordN



Header              Payload



Identifier          Length                Type
Requisitos NFC




Uses Permission                      Intent Filter

      NFC                  android.nfc.action.NDEF_DISCOVERED
Leer un mensaje NDEF
public void onNewIntent(Intent intent) {
   if (NfcAdapter.ACTION_NDEF_DISCOVERED.
       equals(intent.getAction())) {
       Parcelable[] rawMsgs = intent.
                   getParcelableArrayExtra(
                   NfcAdapter.EXTRA_NDEF_MESSAGES);
       NdefMessage[] msgs;
       if (rawMsgs != null) {
           msgs = new NdefMessage[rawMsgs.length];
           for (int i = 0; i < rawMsgs.length; i++) {
               msgs[i] = (NdefMessage) rawMsgs[i];
           }
       }
       //Process Messages
    }
}
Opciones de dispatching
Classic Intent          NFC Foreground                      Android App
   Dispatch                Dispatch                           Record



                  mNfcAdapter.
                      enableForegroundDispatch(
                      ...);

                                                   NdefRecord.
                                                       createApplicationRecord(
                                                       “com.example.nfc.beam”);


                  mNfcAdapter.
                      disableForegroundDispatch(
                      this);
Escribir en una Tag
private void write(Tag tag) throws IOException,
   FormatException {

        NdefRecord[] records = { createRecord() };
        NdefMessage message = new NdefMessage(records);

        // Get an instance of Ndef for the tag.
        Ndef ndef = Ndef.get(tag);

        // Enable I/O
        ndef.connect();

        // Write the message
        ndef.writeNdefMessage(message);

        // Close the connection
        ndef.close();
}
Android Beam

public class BluetoothChat extends Activity implements
   CreateNdefMessageCallback{

    @Override
    public NdefMessage createNdefMessage(NfcEvent event) {
       try {
           NdefRecord[] records = { createRecord() };
           NdefMessage message = new NdefMessage(records);

          return message;
       } catch (UnsupportedEncodingException e) {
          //Handle error here
       }
       return null;
}
Demo time!
“Chuck Norris puede estrangular a un hombre con el cable
de una conexión Wi-Fi.”
                                           -Proverbio chino
200x




                       28x

            12x
 1x

BT 2.1   BT 3.0+HS   WiFi 11g   WiFi 11n
Peers




Group Owner
Requisitos Wi-Fi Direct



Ice Cream                    Permisos
Sandwich
                         ACCESS_WIFI_STATE
                         CHANGE_WIFI_STATE
                       CHANGE_NETWORK_STATE
                             INTERNET
                       ACCESS_NETWORK_STATE
Con un receiver voy sobrado




    WIFI_STATE_CHANGED_ACTION          WIFI_P2P_PEERS_CHANGED_ACTION




WIFI_P2P_CONNECTION_CHANGED_ACTION   WIFI_P2P_THIS_DEVICE_CHANGED_ACTION
Y esto es todo lo que hay que saber


      Listener                Métodos                  Eventos

                             connect(),               onSuccess()
    ActionListener
                          cancelConnect(),...          onFailure()

   ChannelListener            initialize()      onChannelDisconnected()

ConnectionInfoListener   requestConnectInfo()   onConnectionAvailable()

  GroupInfoListener       requestGroupInfo()     onGroupInfoAvailable()

   PeerListListener         requestPeers()         onPeersAvailable()
¡Peer a la vista!

mManager = (WifiP2pManager)
   getSystemService(Context.WIFI_P2P_SERVICE);
mChannel = mManager.initialize(this, getMainLooper(), null);
mReceiver = new WiFiDirectBroadcastReceiver(mManager,mChannel,this);

mManager.discoverPeers(channel, new WifiP2pManager.ActionListener() {
        @Override
        public void onSuccess() {
            //success logic
        }

          @Override
          public void onFailure(int reasonCode) {
              //failure logic
          }
    });
Mientras en el receiver...


if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
    if (mManager != null) {
       mManager.requestPeers(mChannel, new PeerListListener(){

              @Override
              public void onPeersAvailable(WifiP2pDeviceList list) {
                  //Update Peer List, data model, etc...
              }

        });
    }
}
Frecuencias de llamadas abiertas

WifiP2pDevice device = new WifiP2pDevice();
WifiP2pConfig config = new WifiP2pConfig();
config.deviceAddress = device.deviceAddress;
mManager.connect(mChannel, config, new ActionListener() {

        @Override
        public void onSuccess() {
            //ready for connecting through a socket
        }

        @Override
        public void onFailure(int reason) {
            //failure logic
        }
});
Superioridad aérea


     Sencillo


      Mágico
¡Muchas gracias!
                   Saúl Díaz González
                      saul@tuenti.com
                             @sefford

More Related Content

What's hot

Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportMuragesh Kabbinakantimath
 
[213] ethereum
[213] ethereum[213] ethereum
[213] ethereumNAVER D2
 
[4] 아두이노와 인터넷
[4] 아두이노와 인터넷[4] 아두이노와 인터넷
[4] 아두이노와 인터넷Chiwon Song
 
Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03
Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03
Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03Mathias Herberts
 
The (unknown) collections module
The (unknown) collections moduleThe (unknown) collections module
The (unknown) collections modulePablo Enfedaque
 
Everything I always wanted to know about crypto, but never thought I'd unders...
Everything I always wanted to know about crypto, but never thought I'd unders...Everything I always wanted to know about crypto, but never thought I'd unders...
Everything I always wanted to know about crypto, but never thought I'd unders...Codemotion
 
How to recover malare assembly codes
How to recover malare assembly codesHow to recover malare assembly codes
How to recover malare assembly codesFACE
 
집단지성 프로그래밍 08-가격모델링
집단지성 프로그래밍 08-가격모델링집단지성 프로그래밍 08-가격모델링
집단지성 프로그래밍 08-가격모델링Kwang Woo NAM
 
Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012yantoit2011
 
The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212Mahmoud Samir Fayed
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with nettyZauber
 
groovy databases
groovy databasesgroovy databases
groovy databasesPaul King
 

What's hot (20)

Error Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks reportError Control in Multimedia Communications using Wireless Sensor Networks report
Error Control in Multimedia Communications using Wireless Sensor Networks report
 
[213] ethereum
[213] ethereum[213] ethereum
[213] ethereum
 
[4] 아두이노와 인터넷
[4] 아두이노와 인터넷[4] 아두이노와 인터넷
[4] 아두이노와 인터넷
 
Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03
Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03
Warp 10 Platform Presentation - Criteo Beer & Tech 2016-02-03
 
The (unknown) collections module
The (unknown) collections moduleThe (unknown) collections module
The (unknown) collections module
 
Everything I always wanted to know about crypto, but never thought I'd unders...
Everything I always wanted to know about crypto, but never thought I'd unders...Everything I always wanted to know about crypto, but never thought I'd unders...
Everything I always wanted to know about crypto, but never thought I'd unders...
 
How to recover malare assembly codes
How to recover malare assembly codesHow to recover malare assembly codes
How to recover malare assembly codes
 
집단지성 프로그래밍 08-가격모델링
집단지성 프로그래밍 08-가격모델링집단지성 프로그래밍 08-가격모델링
집단지성 프로그래밍 08-가격모델링
 
Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012Ebook Pembuatan Aplikasi tiket kapal 2012
Ebook Pembuatan Aplikasi tiket kapal 2012
 
The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202The Ring programming language version 1.8 book - Part 54 of 202
The Ring programming language version 1.8 book - Part 54 of 202
 
Lập trình Python cơ bản
Lập trình Python cơ bảnLập trình Python cơ bản
Lập trình Python cơ bản
 
The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212The Ring programming language version 1.10 book - Part 56 of 212
The Ring programming language version 1.10 book - Part 56 of 212
 
Non blocking io with netty
Non blocking io with nettyNon blocking io with netty
Non blocking io with netty
 
Introducing to Asynchronous Programming
Introducing to Asynchronous  ProgrammingIntroducing to Asynchronous  Programming
Introducing to Asynchronous Programming
 
Npc13
Npc13Npc13
Npc13
 
Qt Rest Server
Qt Rest ServerQt Rest Server
Qt Rest Server
 
Ns network simulator
Ns network simulatorNs network simulator
Ns network simulator
 
groovy databases
groovy databasesgroovy databases
groovy databases
 
isd312-05-wordnet
isd312-05-wordnetisd312-05-wordnet
isd312-05-wordnet
 
Hacking the swisscom modem
Hacking the swisscom modemHacking the swisscom modem
Hacking the swisscom modem
 

Viewers also liked

Open im vol16_lt_cnomiya_next_thing
Open im vol16_lt_cnomiya_next_thingOpen im vol16_lt_cnomiya_next_thing
Open im vol16_lt_cnomiya_next_thingNTTDATA INTRAMART
 
Online Training @ Nitade Chula
Online Training @ Nitade ChulaOnline Training @ Nitade Chula
Online Training @ Nitade ChulanudeJEH
 
2013年度下期パートナー会 開発本部
2013年度下期パートナー会 開発本部2013年度下期パートナー会 開発本部
2013年度下期パートナー会 開発本部NTTDATA INTRAMART
 
Digital Natives with a Cause newsletter - Changing Face Of Citizen Action
Digital Natives with a Cause newsletter - Changing Face Of Citizen ActionDigital Natives with a Cause newsletter - Changing Face Of Citizen Action
Digital Natives with a Cause newsletter - Changing Face Of Citizen ActionNilofar Ansher
 
Gandhi Heritage Portal ... A March towards preserving heritage
Gandhi Heritage Portal ... A March towards preserving heritageGandhi Heritage Portal ... A March towards preserving heritage
Gandhi Heritage Portal ... A March towards preserving heritageDr. Viratkumar Kothari
 
Presentatie Astorium
Presentatie AstoriumPresentatie Astorium
Presentatie AstoriumMustafa Cevik
 
Agile2015 short paper presentation: Development of Complex Software with Agil...
Agile2015 short paper presentation: Development of Complex Software with Agil...Agile2015 short paper presentation: Development of Complex Software with Agil...
Agile2015 short paper presentation: Development of Complex Software with Agil...Alan Braz
 
Boutique hotels in goa
Boutique hotels in goaBoutique hotels in goa
Boutique hotels in goapiresprisca
 
Making Learning Accessible Presentation
Making Learning Accessible PresentationMaking Learning Accessible Presentation
Making Learning Accessible PresentationDesiree' Slaughter
 
Hot skills исследование страховых компаний_2011
Hot skills исследование страховых компаний_2011Hot skills исследование страховых компаний_2011
Hot skills исследование страховых компаний_2011Sergey Onenko
 
งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1cattyloverose
 
исследование рынка аутсорсинговых контактных центров украины
исследование рынка аутсорсинговых контактных центров украиныисследование рынка аутсорсинговых контактных центров украины
исследование рынка аутсорсинговых контактных центров украиныSergey Onenko
 
Wringing Performance out of Perl
Wringing Performance out of PerlWringing Performance out of Perl
Wringing Performance out of PerlLeonard Budney
 
Guide Marketing For Facebook
Guide Marketing For FacebookGuide Marketing For Facebook
Guide Marketing For FacebookIrwan Setiawan
 

Viewers also liked (20)

Open im vol16_lt_cnomiya_next_thing
Open im vol16_lt_cnomiya_next_thingOpen im vol16_lt_cnomiya_next_thing
Open im vol16_lt_cnomiya_next_thing
 
Online Training @ Nitade Chula
Online Training @ Nitade ChulaOnline Training @ Nitade Chula
Online Training @ Nitade Chula
 
Indian polity 11
Indian polity 11Indian polity 11
Indian polity 11
 
2013年度下期パートナー会 開発本部
2013年度下期パートナー会 開発本部2013年度下期パートナー会 開発本部
2013年度下期パートナー会 開発本部
 
Digital Natives with a Cause newsletter - Changing Face Of Citizen Action
Digital Natives with a Cause newsletter - Changing Face Of Citizen ActionDigital Natives with a Cause newsletter - Changing Face Of Citizen Action
Digital Natives with a Cause newsletter - Changing Face Of Citizen Action
 
Fotonaturaleza
FotonaturalezaFotonaturaleza
Fotonaturaleza
 
Gandhi Heritage Portal ... A March towards preserving heritage
Gandhi Heritage Portal ... A March towards preserving heritageGandhi Heritage Portal ... A March towards preserving heritage
Gandhi Heritage Portal ... A March towards preserving heritage
 
Presentatie Astorium
Presentatie AstoriumPresentatie Astorium
Presentatie Astorium
 
Dagger for dummies
Dagger for dummiesDagger for dummies
Dagger for dummies
 
Mirsis Corporate Overview
Mirsis Corporate OverviewMirsis Corporate Overview
Mirsis Corporate Overview
 
Agile2015 short paper presentation: Development of Complex Software with Agil...
Agile2015 short paper presentation: Development of Complex Software with Agil...Agile2015 short paper presentation: Development of Complex Software with Agil...
Agile2015 short paper presentation: Development of Complex Software with Agil...
 
Boutique hotels in goa
Boutique hotels in goaBoutique hotels in goa
Boutique hotels in goa
 
Making Learning Accessible Presentation
Making Learning Accessible PresentationMaking Learning Accessible Presentation
Making Learning Accessible Presentation
 
Photoessay
PhotoessayPhotoessay
Photoessay
 
Hot skills исследование страховых компаний_2011
Hot skills исследование страховых компаний_2011Hot skills исследование страховых компаний_2011
Hot skills исследование страховых компаний_2011
 
งานนำเสนอ1
งานนำเสนอ1งานนำเสนอ1
งานนำเสนอ1
 
исследование рынка аутсорсинговых контактных центров украины
исследование рынка аутсорсинговых контактных центров украиныисследование рынка аутсорсинговых контактных центров украины
исследование рынка аутсорсинговых контактных центров украины
 
Wringing Performance out of Perl
Wringing Performance out of PerlWringing Performance out of Perl
Wringing Performance out of Perl
 
CIIS
CIIS CIIS
CIIS
 
Guide Marketing For Facebook
Guide Marketing For FacebookGuide Marketing For Facebook
Guide Marketing For Facebook
 

Similar to Air superiority for Android Apps

IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2John Staveley
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure CallNadia Nahar
 
Cassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewCassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewJoshua McKenzie
 
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Amarjeetsingh Thakur
 
HBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsHBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsCloudera, Inc.
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkCaio Pereira
 
MCE^3 - Dariusz Seweryn, Paweł Urban - Demystifying Android's Bluetooth Low ...
MCE^3 - Dariusz Seweryn, Paweł Urban -  Demystifying Android's Bluetooth Low ...MCE^3 - Dariusz Seweryn, Paweł Urban -  Demystifying Android's Bluetooth Low ...
MCE^3 - Dariusz Seweryn, Paweł Urban - Demystifying Android's Bluetooth Low ...PROIDEA
 
Demystifying Android's Bluetooth Low Energy at MCE^3 Conf
Demystifying Android's Bluetooth Low Energy at MCE^3 ConfDemystifying Android's Bluetooth Low Energy at MCE^3 Conf
Demystifying Android's Bluetooth Low Energy at MCE^3 ConfPawel Urban
 
JSR 82 (bluetooth obex)
JSR 82 (bluetooth obex)JSR 82 (bluetooth obex)
JSR 82 (bluetooth obex)SMIJava
 
Assistive Technology_Research
Assistive Technology_ResearchAssistive Technology_Research
Assistive Technology_ResearchMeng Kry
 
Android Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth ConnectionAndroid Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth ConnectionJussi Pohjolainen
 
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time webAndrew Fisher
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneDroidConTLV
 
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 AgentPandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 AgentPandora FMS
 
How to build own IoT Platform
How to build own IoT PlatformHow to build own IoT Platform
How to build own IoT PlatformPatryk Omiotek
 

Similar to Air superiority for Android Apps (20)

IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2IoT on Raspberry PI v1.2
IoT on Raspberry PI v1.2
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure Call
 
Cassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, OverviewCassandra 2.1 boot camp, Overview
Cassandra 2.1 boot camp, Overview
 
Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)Introduction to Things board (An Open Source IoT Cloud Platform)
Introduction to Things board (An Open Source IoT Cloud Platform)
 
HBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to CoprocessorsHBaseCon 2013: A Developer’s Guide to Coprocessors
HBaseCon 2013: A Developer’s Guide to Coprocessors
 
Android 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and NetworkAndroid 4.2 Internals - Bluetooth and Network
Android 4.2 Internals - Bluetooth and Network
 
MCE^3 - Dariusz Seweryn, Paweł Urban - Demystifying Android's Bluetooth Low ...
MCE^3 - Dariusz Seweryn, Paweł Urban -  Demystifying Android's Bluetooth Low ...MCE^3 - Dariusz Seweryn, Paweł Urban -  Demystifying Android's Bluetooth Low ...
MCE^3 - Dariusz Seweryn, Paweł Urban - Demystifying Android's Bluetooth Low ...
 
Demystifying Android's Bluetooth Low Energy at MCE^3 Conf
Demystifying Android's Bluetooth Low Energy at MCE^3 ConfDemystifying Android's Bluetooth Low Energy at MCE^3 Conf
Demystifying Android's Bluetooth Low Energy at MCE^3 Conf
 
Nfc on Android
Nfc on AndroidNfc on Android
Nfc on Android
 
JSR 82 (bluetooth obex)
JSR 82 (bluetooth obex)JSR 82 (bluetooth obex)
JSR 82 (bluetooth obex)
 
Assistive Technology_Research
Assistive Technology_ResearchAssistive Technology_Research
Assistive Technology_Research
 
Android wearpp
Android wearppAndroid wearpp
Android wearpp
 
Android Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth ConnectionAndroid Wi-Fi Manager and Bluetooth Connection
Android Wi-Fi Manager and Bluetooth Connection
 
Arduino and the real time web
Arduino and the real time webArduino and the real time web
Arduino and the real time web
 
Npc08
Npc08Npc08
Npc08
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
 
Pandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 AgentPandora FMS: Windows Phone 7 Agent
Pandora FMS: Windows Phone 7 Agent
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
How to build own IoT Platform
How to build own IoT PlatformHow to build own IoT Platform
How to build own IoT Platform
 

Recently uploaded

A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 

Recently uploaded (20)

A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 

Air superiority for Android Apps

  • 1. SUPERIORIDAD AÉREA EN APLICACIONES ANDROID Saúl Díaz González saul@tuenti.com
  • 2. Wi-Fi 802.11 N Near-Field Comm. Bluetooth 3.0 + HS
  • 3. “¿Cómo mejorarlo? Le pondremos Bluetooth. ¡Todo es mejor con Bluetooth!” -Sheldon Cooper
  • 4. Búsqueda Descubrimiento Conectar Aceptar ¡Emparejados!
  • 5. Clases clave Descubrir Bluetooth Bluetooth Adapter Device Bluetooth Crear Adapter Conectar Bluetooth Bluetooth Aceptar Server Socket Socket
  • 6. Activando el Bluetooth BLUETOOTH BLUETOOTH_ADMIN mBtAdapter = BluetoothAdapter.getDefaultAdapter(); mBtAdapter == null? Si Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(intent, REQUEST_ENABLE_BT);
  • 7. Descubrimiento Cliente Servidor Intent(BluetoothAdapter. mBtAdapter.startDiscovery(); ACTION_REQUEST_DISCOVERABLE); Intent.putExtra(BluetoothAdapter. EXTRA_DISCOVERABLE_DURATION, 300); IntentFilter(BluetoothDevice. ACTION_FOUND); registerReceiver(mReceiver, filter); intent.getParcelableExtra( BluetoothDevice.EXTRA_DEVICE);
  • 8. Conexión Cliente Servidor btDevice. mBtAdapter. createRfcommSocketToServiceRecord( listenUsingRfcommWithServiceRecord(NAME, MY_UUID); MY_UUID); clientSocket.connect(); serverSocket.accept(); in = socket.getInputStream(); out = socket.getOutputStream(); in.read(buffer) //Buffer is byte[] out.write(buffer)
  • 9. “Cualquier tecnología lo suficientemente avanzada es indistinguible de la magia” -Arthur C. Clarke
  • 10. NFC Tag Write Read Android Beam
  • 11. NFC Data Exchange Format (NDEF) Record1 Record2 ... RecordN Header Payload Identifier Length Type
  • 12. Requisitos NFC Uses Permission Intent Filter NFC android.nfc.action.NDEF_DISCOVERED
  • 13. Leer un mensaje NDEF public void onNewIntent(Intent intent) { if (NfcAdapter.ACTION_NDEF_DISCOVERED. equals(intent.getAction())) { Parcelable[] rawMsgs = intent. getParcelableArrayExtra( NfcAdapter.EXTRA_NDEF_MESSAGES); NdefMessage[] msgs; if (rawMsgs != null) { msgs = new NdefMessage[rawMsgs.length]; for (int i = 0; i < rawMsgs.length; i++) { msgs[i] = (NdefMessage) rawMsgs[i]; } } //Process Messages } }
  • 14. Opciones de dispatching Classic Intent NFC Foreground Android App Dispatch Dispatch Record mNfcAdapter. enableForegroundDispatch( ...); NdefRecord. createApplicationRecord( “com.example.nfc.beam”); mNfcAdapter. disableForegroundDispatch( this);
  • 15. Escribir en una Tag private void write(Tag tag) throws IOException, FormatException { NdefRecord[] records = { createRecord() }; NdefMessage message = new NdefMessage(records); // Get an instance of Ndef for the tag. Ndef ndef = Ndef.get(tag); // Enable I/O ndef.connect(); // Write the message ndef.writeNdefMessage(message); // Close the connection ndef.close(); }
  • 16. Android Beam public class BluetoothChat extends Activity implements CreateNdefMessageCallback{ @Override public NdefMessage createNdefMessage(NfcEvent event) { try { NdefRecord[] records = { createRecord() }; NdefMessage message = new NdefMessage(records); return message; } catch (UnsupportedEncodingException e) { //Handle error here } return null; }
  • 18. “Chuck Norris puede estrangular a un hombre con el cable de una conexión Wi-Fi.” -Proverbio chino
  • 19. 200x 28x 12x 1x BT 2.1 BT 3.0+HS WiFi 11g WiFi 11n
  • 21. Requisitos Wi-Fi Direct Ice Cream Permisos Sandwich ACCESS_WIFI_STATE CHANGE_WIFI_STATE CHANGE_NETWORK_STATE INTERNET ACCESS_NETWORK_STATE
  • 22. Con un receiver voy sobrado WIFI_STATE_CHANGED_ACTION WIFI_P2P_PEERS_CHANGED_ACTION WIFI_P2P_CONNECTION_CHANGED_ACTION WIFI_P2P_THIS_DEVICE_CHANGED_ACTION
  • 23. Y esto es todo lo que hay que saber Listener Métodos Eventos connect(), onSuccess() ActionListener cancelConnect(),... onFailure() ChannelListener initialize() onChannelDisconnected() ConnectionInfoListener requestConnectInfo() onConnectionAvailable() GroupInfoListener requestGroupInfo() onGroupInfoAvailable() PeerListListener requestPeers() onPeersAvailable()
  • 24. ¡Peer a la vista! mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); mChannel = mManager.initialize(this, getMainLooper(), null); mReceiver = new WiFiDirectBroadcastReceiver(mManager,mChannel,this); mManager.discoverPeers(channel, new WifiP2pManager.ActionListener() { @Override public void onSuccess() { //success logic } @Override public void onFailure(int reasonCode) { //failure logic } });
  • 25. Mientras en el receiver... if (WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) { if (mManager != null) { mManager.requestPeers(mChannel, new PeerListListener(){ @Override public void onPeersAvailable(WifiP2pDeviceList list) { //Update Peer List, data model, etc... } }); } }
  • 26. Frecuencias de llamadas abiertas WifiP2pDevice device = new WifiP2pDevice(); WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; mManager.connect(mChannel, config, new ActionListener() { @Override public void onSuccess() { //ready for connecting through a socket } @Override public void onFailure(int reason) { //failure logic } });
  • 27. Superioridad aérea Sencillo Mágico
  • 28. ¡Muchas gracias! Saúl Díaz González saul@tuenti.com @sefford