SlideShare a Scribd company logo
Android
Accessories
Sathish. R
13-Nov-13





Roadmap
Bluetooth
Wi-Fi
Sensors









Motion Sensors
Position Sensors
Environment
Sensors

Send/ Receive
SMS
Shared Preference
Hands-on

Android
Accessories
Session 3

Tenet Technetronics
13-Nov-13

Bluetooth
o
o

o

Which allows a device to wirelessly exchange
data with other Bluetooth devices.
The application framework provides access
to the Bluetooth functionality through the
Android Bluetooth APIs.
Bluetooth APIs let applications wirelessly
connect to other Bluetooth devices.
Tenet Technetronics
13-Nov-13

Bluetooth Cont.
o
o
o
o
o

Scan for other Bluetooth devices
Query the local Bluetooth adapter for paired
Bluetooth devices
Establish RFCOMM channels
Connect to other devices through service
discovery
Transfer data to and from other devices
Tenet Technetronics
13-Nov-13

Bluetooth Cont.
All of the Bluetooth APIs are available in
the android. Bluetooth package.
The four major tasks necessary to communicate
using Bluetooth.






setting up Bluetooth,
finding devices that are either paired or available in
the local area,
connecting devices &
transferring data between devices.
Tenet Technetronics
13-Nov-13

Bluetooth Cont.
The classes and interfaces you will need to
create Bluetooth connections:






Bluetooth Adapter.
Bluetooth Device.
Bluetooth Socket.
Bluetooth Server Socket.
Tenet Technetronics
13-Nov-13

Bluetooth Permissions.
o
o

We must declare the Bluetooth
permission BLUETOOTH.
To initiate device discovery or manipulate
Bluetooth settings, we must also declare
the BLUETOOTH_ADMIN permission.

Tenet Technetronics
13-Nov-13

Setting Up Bluetooth
Verify that Bluetooth is supported on the
device.
If Bluetooth is not supported, then disable
any Bluetooth features.
o
o

Get the BluetoothAdapter.
Enable Bluetooth.
Tenet Technetronics
13-Nov-13

Setting Up Bluetooth
Get Bluetooth Adapter:
The BluetoothAdapter is required for any
and all Bluetooth activity.

Tenet Technetronics
13-Nov-13

Setting Up Bluetooth
Enable Bluetooth.
o
o

Ensure that Bluetooth is enabled.
Call isEnabled() to check whether
Bluetooth is currently enable. If this
method returns false, then Bluetooth is
disabled.
Tenet Technetronics
13-Nov-13

Finding Devices
o

o

o

Find remote Bluetooth devices either through device
discovery or by querying the list of paired (bonded)
devices.
Device discovery is a scanning procedure that
searches the local area for Bluetooth enabled
devices.
A Bluetooth device within the local area will respond
to a discovery request only if it is currently enabled to
be discoverable
Tenet Technetronics
13-Nov-13

Querying paired devices
o
o

Before performing device discovery, its
worth querying the set of paired devices.
call getBondedDevices().

Tenet Technetronics
13-Nov-13

Discovering devices
o
o

o

simply call startDiscovery().
The method will immediately return with a
Boolean indicating whether discovery has
successfully started.
Involves an inquiry scan of about 12 seconds,
followed by a page scan of each found
device to retrieve its Bluetooth name.
Tenet Technetronics
13-Nov-13

Discovering devices
o

o

Register a Broadcast Receiver for
the ACTION_FOUND Intent in order to receive
information about each device discovered.
This Intent carries the extra
fields EXTRA_DEVICE and EXTRA_CLASS,
containing a BluetoothDevice and a
BluetoothClass.
Tenet Technetronics
13-Nov-13

Discovering devices

Tenet Technetronics
13-Nov-13

Connecting Devices
o

o

To create a connection between two
devices, implement both the server-side and
client-side mechanisms.
If the two devices have not been previously
paired, then the Android framework will
automatically show a pairing request
notification or dialog to the user during the
connection procedure.
Tenet Technetronics
13-Nov-13

Connecting as a server
o
o

One must act as a server by holding an
open BluetoothServerSocket.
The server socket is to listen for incoming
connection requests.




Get a BluetoothServerSocket by calling the
listenUsingRfcommWithServiceRecord(String, UUID).
Start listening for connection requests by
calling accept().
Unless you want to accept additional connections,
call close().

Tenet Technetronics
13-Nov-13

Tenet Technetronics
13-Nov-13

Connecting as a client
To initiate a connection with a remote
device , obtain the remote device.
o Using the Bluetooth Device, get a
BluetoothSocket by calling
createRfcommSocketToServiceRecord (UUID).
Note : The UUID passed here must match the
UUID used by the server device when it opened
its BluetoothServerSocket
o

Tenet Technetronics
13-Nov-13

Connecting as a client
o
o

o

Initiate the connection by calling connect().
We should always ensure that the device is
not performing device discovery when you
call connect().
If discovery is in progress, then the
connection attempt will be significantly
slowed and is more likely to fail.
Tenet Technetronics
13-Nov-13

Tenet Technetronics
13-Nov-13

Managing a Connection
Once Both Devices are connected
 Get the InputStream and OutputStream that
handle transmissions through the socket,



Read and write data to the streams.
Tenet Technetronics
13-Nov-13

Wi-Fi
o
o

The Primary API for managing all aspects
of Wi-Fi connectivity.
It deals with several categories of items:




The list of configured networks.
The currently active Wi-Fi network.
Results of access point scans.
Tenet Technetronics
13-Nov-13

Turn On/Off Wi-Fi
o
o

Need to use WiFiManager class.
Create an Object of WiFiManager class to
get the services of Wi-Fi.

Tenet Technetronics
13-Nov-13

Permission in Manifest
o

When performing Wi-Fi specific
operations, we must declare permissions
in manifest file

Tenet Technetronics
13-Nov-13

Sensors
o

o

Most Android-powered devices
have built-in sensors that measure
motion, orientation, and various
environmental conditions.
These sensors are capable of
providing raw data with high
precision and accuracy, and are
useful
Tenet Technetronics
13-Nov-13

Sensors
The Android platform supports three broad categories of sensors:


Motion sensors (accelerometers, gravity sensors, gyroscopes)



Environmental sensors (pressure, illumination, and humidity)



Position sensors ( orientation sensors and magnetometers)

We can access sensors available on the device and acquire raw
sensor data by using the Android sensor framework.
Tenet Technetronics
13-Nov-13

Sensors
We can use the sensor framework to do the following:
 Determine which sensors are available on a device.
 Determine an individual sensor's capabilities, such as
its maximum range, manufacturer, power
requirements, and resolution.
 Acquire raw sensor data and define the minimum
rate at which you acquire sensor data.
 Register and unregister sensor event listeners that
monitor sensor changes.
Tenet Technetronics
13-Nov-13

Identifying Sensors and Sensor
Capabilities
o

o

The Android sensor framework provides
several methods to determine at runtime
which sensors are on a device.
To identify the sensors that are on a
device you first need to get a reference
to the sensor service.
Tenet Technetronics
13-Nov-13

Access Sensors:
o

We can get a listing of every sensor on a
device by calling
the getSensorList() method

Tenet Technetronics
13-Nov-13

Monitoring Sensor Events
To monitor raw sensor data you need to
implement two callback methods of
SensorEventListener interface.
 onAccuracyChanged() and
 onSensorChanged().
Tenet Technetronics
13-Nov-13

Tenet Technetronics
33

13 November 2013

Send SMS
o

Add permission in manifest.xml

o

To send sms we need sms manager.

Tenet Technetronics
34

13 November 2013

Send SMS
The sendTextMessages() method takes five
arguments:
o destinationAddress
o scAddress
o Content of the SMS message
o sentIntent
o deliveryIntent
Tenet Technetronics
35

13 November 2013

Receive SMS
o

Declare Broadcast receiver in Android
Manifest.xml

o

Give read SMS permission in AndroidManifest

o

Get the object of SmsManager to find out
received sms details
Tenet Technetronics
36

13 November 2013

Receive SMS
BroadcastReceiver receiver = new BroadcastReceiver() {
public void onReceive(Context c, Intent in) {
if(in.getAction().equals(RECEIVED_ACTION)) {
Bundle bundle = in.getExtras();
if(bundle!=null) {
Object[] pdus = (Object[])bundle.get(“pdus”);
SmsMessage[] msgs = new SmsMessage[pdus.length];
for(int i = 0; i<pdus.length; i++) {
msgs[i] =
SmsMessage.createFromPdu((byte[])pdus[i]);
}
// reply();
}
}
}};

Tenet Technetronics
37

13 November 2013

Shared Preferences
o
o
o
o
o

Android provides several options to save
persistent application data
Store private primitive data in key-value pairs.
Application shared preferences allows you to
save and retrieve key, value pair data.
Boolean, float, int, long and string.
These data will persist even app is killed
Tenet Technetronics
38

13 November 2013

Shared Preferences
o

o

Application shared preferences can be
fetched using getSharedPreferences()
method.
We need an editor to edit and save the
changes in shared preferences.
Tenet Technetronics
39

13 November 2013

Shared Preferences
Storing Data:
o You can save data into shared
preferences using editor.
o Call editor. Commit() in order to save
changes to shared preferences.

Tenet Technetronics
40

13 November 2013

Shared Preferences
Retrieving Data
o Data can be retrieved from saved
preferences by calling getString() (For
string) method.

Tenet Technetronics
41

13 November 2013

Shared Preferences
Clearing / Deleting Data
o To delete that particular value, call
remove(“key_name”).

o

If we want to delete all the data,
call clear().
Tenet Technetronics
13-Nov-13

Tenet Technetronics
13-Nov-13

Tenet Technetronics

More Related Content

What's hot

Ccnafile
CcnafileCcnafile
Ccnafile
Shefali Garg
 
Ip addresses
Ip addressesIp addresses
Ip addresses
Computer_ at_home
 
Ch11 Hacking Wireless Networks it-slideshares.blogspot.com
Ch11 Hacking Wireless Networks it-slideshares.blogspot.comCh11 Hacking Wireless Networks it-slideshares.blogspot.com
Ch11 Hacking Wireless Networks it-slideshares.blogspot.com
phanleson
 
Security for automation in Internet of Things by using one time password
Security for automation in Internet of Things by using one time passwordSecurity for automation in Internet of Things by using one time password
Security for automation in Internet of Things by using one time password
SHASHANK WANKHADE
 
IP addressing seminar ppt
IP addressing seminar pptIP addressing seminar ppt
IP addressing seminar ppt
Smriti Rastogi
 
Internet protocols
Internet protocolsInternet protocols
Internet protocols
Rohit Saini
 
Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015
Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015
Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015
CODE BLUE
 
Basics of IP Addressing
Basics of IP AddressingBasics of IP Addressing
Basics of IP Addressing
Kushal Sheth
 
IP classes and subnetting.
IP classes and subnetting.IP classes and subnetting.
IP classes and subnetting.
university of Gujrat, pakistan
 
Ip addressing
Ip addressingIp addressing
Ip addressing
Tapan Khilar
 
Chapter 7 exam
Chapter 7 examChapter 7 exam
Chapter 7 examreiryuzaki
 
Wireless security
Wireless securityWireless security
Wireless security
Aurobindo Nayak
 
ipv4 (internet protocol version 4)
  ipv4 (internet protocol version 4)     ipv4 (internet protocol version 4)
ipv4 (internet protocol version 4)
sanchitachandrakar94
 
Ipv6^ new
Ipv6^ newIpv6^ new
Ip address
Ip addressIp address
Ip address
MdAnikKhan
 
Ip address
Ip address Ip address
Ip address
Yash Bansal
 
Ipaddressing spk1
Ipaddressing spk1Ipaddressing spk1
Ipaddressing spk1
SupriyaKurlekar2
 
PASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTA
PASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTAPASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTA
PASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTA
HEMANTA SAHU
 
IP Address
IP AddressIP Address
IP Address
Netwax Lab
 

What's hot (20)

Ccnafile
CcnafileCcnafile
Ccnafile
 
Ip addresses
Ip addressesIp addresses
Ip addresses
 
Ch11 Hacking Wireless Networks it-slideshares.blogspot.com
Ch11 Hacking Wireless Networks it-slideshares.blogspot.comCh11 Hacking Wireless Networks it-slideshares.blogspot.com
Ch11 Hacking Wireless Networks it-slideshares.blogspot.com
 
Security for automation in Internet of Things by using one time password
Security for automation in Internet of Things by using one time passwordSecurity for automation in Internet of Things by using one time password
Security for automation in Internet of Things by using one time password
 
IP addressing seminar ppt
IP addressing seminar pptIP addressing seminar ppt
IP addressing seminar ppt
 
Internet protocols
Internet protocolsInternet protocols
Internet protocols
 
Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015
Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015
Wireless security testing with attack by Keiichi Horiai - CODE BLUE 2015
 
Basics of IP Addressing
Basics of IP AddressingBasics of IP Addressing
Basics of IP Addressing
 
IP classes and subnetting.
IP classes and subnetting.IP classes and subnetting.
IP classes and subnetting.
 
Ip addressing
Ip addressingIp addressing
Ip addressing
 
Chapter 7 exam
Chapter 7 examChapter 7 exam
Chapter 7 exam
 
Wireless security
Wireless securityWireless security
Wireless security
 
ipv4 (internet protocol version 4)
  ipv4 (internet protocol version 4)     ipv4 (internet protocol version 4)
ipv4 (internet protocol version 4)
 
Lecture9
Lecture9Lecture9
Lecture9
 
Ipv6^ new
Ipv6^ newIpv6^ new
Ipv6^ new
 
Ip address
Ip addressIp address
Ip address
 
Ip address
Ip address Ip address
Ip address
 
Ipaddressing spk1
Ipaddressing spk1Ipaddressing spk1
Ipaddressing spk1
 
PASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTA
PASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTAPASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTA
PASSWORD PROTECTED DOOR OPENING SYSTEM BY HEMANTA
 
IP Address
IP AddressIP Address
IP Address
 

Viewers also liked

Hammer webinar final
Hammer webinar finalHammer webinar final
Hammer webinar final
Robert "Alan" Black, Ph.D., CSP
 
Star segment: housewares; casual lifestyles change face of industry.
Star segment: housewares; casual lifestyles change face of industry.Star segment: housewares; casual lifestyles change face of industry.
Star segment: housewares; casual lifestyles change face of industry.
dampfinances8895
 
Android introduction session 1
Android introduction session 1Android introduction session 1
Android introduction session 1Sathish Raju
 
Location Matters for New England
Location Matters for New EnglandLocation Matters for New England
Location Matters for New England
Lincoln Institute of Land Policy
 
SBCC Framework
SBCC FrameworkSBCC Framework
SBCC FrameworkCChange
 

Viewers also liked (8)

Hammer webinar final
Hammer webinar finalHammer webinar final
Hammer webinar final
 
Star segment: housewares; casual lifestyles change face of industry.
Star segment: housewares; casual lifestyles change face of industry.Star segment: housewares; casual lifestyles change face of industry.
Star segment: housewares; casual lifestyles change face of industry.
 
Android introduction session 1
Android introduction session 1Android introduction session 1
Android introduction session 1
 
New Options
New OptionsNew Options
New Options
 
Location Matters for New England
Location Matters for New EnglandLocation Matters for New England
Location Matters for New England
 
4 c group
4 c group4 c group
4 c group
 
Aditya birla chemicals
Aditya birla chemicalsAditya birla chemicals
Aditya birla chemicals
 
SBCC Framework
SBCC FrameworkSBCC Framework
SBCC Framework
 

Similar to Android accessories session 2

Android bluetooth robot
Android  bluetooth robotAndroid  bluetooth robot
Android bluetooth robotSathish Raju
 
Internet 0f Things IoT.pdf
Internet 0f Things IoT.pdfInternet 0f Things IoT.pdf
Internet 0f Things IoT.pdf
Muhammad Ali
 
JSR-82 Bluetooth tutorial
JSR-82 Bluetooth tutorialJSR-82 Bluetooth tutorial
JSR-82 Bluetooth tutorial
Soham Sengupta
 
Android based security and home
Android based security and homeAndroid based security and home
Android based security and home
ijasa
 
COMPARATIVE STUDY BETWEEN VARIOUS PROTOCOLS USED IN INTERNET OF THING
COMPARATIVE STUDY BETWEEN VARIOUS  PROTOCOLS USED IN INTERNET OF THINGCOMPARATIVE STUDY BETWEEN VARIOUS  PROTOCOLS USED IN INTERNET OF THING
COMPARATIVE STUDY BETWEEN VARIOUS PROTOCOLS USED IN INTERNET OF THING
IJTRET-International Journal of Trendy Research in Engineering and Technology
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Design and implement WSN/IOT smart parking management system using microcontr...
Design and implement WSN/IOT smart parking management system using microcontr...Design and implement WSN/IOT smart parking management system using microcontr...
Design and implement WSN/IOT smart parking management system using microcontr...
IJECEIAES
 
Tools.pptx
Tools.pptxTools.pptx
Tools.pptx
ImXaib
 
actuator device configuration by NFC
actuator device configuration by NFCactuator device configuration by NFC
actuator device configuration by NFC
Sandeep P M
 
Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)
RAHUL TRIPATHI
 
Automatic Free Parking Slot Status Intimating System
Automatic Free Parking Slot Status Intimating SystemAutomatic Free Parking Slot Status Intimating System
Automatic Free Parking Slot Status Intimating System
IRJET Journal
 
Intelligent Device TO Device Communication Using IoT
 Intelligent Device TO Device Communication Using IoT Intelligent Device TO Device Communication Using IoT
Intelligent Device TO Device Communication Using IoT
IJCERT
 
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
 
POST ASSESSMENT.docx
POST ASSESSMENT.docxPOST ASSESSMENT.docx
POST ASSESSMENT.docx
DexterJamero1
 
Introduction to Internet of Things
Introduction to Internet of ThingsIntroduction to Internet of Things
Introduction to Internet of Things
Sayed Chhattan Shah
 
Bluetooth Based Smart Sensor Network By SAIKIRAN PANJALA
Bluetooth Based Smart Sensor Network By SAIKIRAN PANJALABluetooth Based Smart Sensor Network By SAIKIRAN PANJALA
Bluetooth Based Smart Sensor Network By SAIKIRAN PANJALA
Saikiran Panjala
 
IOT introduction
IOT introductionIOT introduction
IOT introduction
xinoe
 
Introduction-All 'bout IOT
Introduction-All 'bout IOTIntroduction-All 'bout IOT
Introduction-All 'bout IOT
Inxee
 
A Brief Review on Internet of Things
A Brief Review on Internet of ThingsA Brief Review on Internet of Things
A Brief Review on Internet of Things
IRJET Journal
 

Similar to Android accessories session 2 (20)

Android bluetooth robot
Android  bluetooth robotAndroid  bluetooth robot
Android bluetooth robot
 
Internet 0f Things IoT.pdf
Internet 0f Things IoT.pdfInternet 0f Things IoT.pdf
Internet 0f Things IoT.pdf
 
JSR-82 Bluetooth tutorial
JSR-82 Bluetooth tutorialJSR-82 Bluetooth tutorial
JSR-82 Bluetooth tutorial
 
Android based security and home
Android based security and homeAndroid based security and home
Android based security and home
 
COMPARATIVE STUDY BETWEEN VARIOUS PROTOCOLS USED IN INTERNET OF THING
COMPARATIVE STUDY BETWEEN VARIOUS  PROTOCOLS USED IN INTERNET OF THINGCOMPARATIVE STUDY BETWEEN VARIOUS  PROTOCOLS USED IN INTERNET OF THING
COMPARATIVE STUDY BETWEEN VARIOUS PROTOCOLS USED IN INTERNET OF THING
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Design and implement WSN/IOT smart parking management system using microcontr...
Design and implement WSN/IOT smart parking management system using microcontr...Design and implement WSN/IOT smart parking management system using microcontr...
Design and implement WSN/IOT smart parking management system using microcontr...
 
Tools.pptx
Tools.pptxTools.pptx
Tools.pptx
 
actuator device configuration by NFC
actuator device configuration by NFCactuator device configuration by NFC
actuator device configuration by NFC
 
Aquarius_IJARCCE
Aquarius_IJARCCEAquarius_IJARCCE
Aquarius_IJARCCE
 
Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)
 
Automatic Free Parking Slot Status Intimating System
Automatic Free Parking Slot Status Intimating SystemAutomatic Free Parking Slot Status Intimating System
Automatic Free Parking Slot Status Intimating System
 
Intelligent Device TO Device Communication Using IoT
 Intelligent Device TO Device Communication Using IoT Intelligent Device TO Device Communication Using IoT
Intelligent Device TO Device Communication Using IoT
 
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
 
POST ASSESSMENT.docx
POST ASSESSMENT.docxPOST ASSESSMENT.docx
POST ASSESSMENT.docx
 
Introduction to Internet of Things
Introduction to Internet of ThingsIntroduction to Internet of Things
Introduction to Internet of Things
 
Bluetooth Based Smart Sensor Network By SAIKIRAN PANJALA
Bluetooth Based Smart Sensor Network By SAIKIRAN PANJALABluetooth Based Smart Sensor Network By SAIKIRAN PANJALA
Bluetooth Based Smart Sensor Network By SAIKIRAN PANJALA
 
IOT introduction
IOT introductionIOT introduction
IOT introduction
 
Introduction-All 'bout IOT
Introduction-All 'bout IOTIntroduction-All 'bout IOT
Introduction-All 'bout IOT
 
A Brief Review on Internet of Things
A Brief Review on Internet of ThingsA Brief Review on Internet of Things
A Brief Review on Internet of Things
 

Recently uploaded

MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 

Recently uploaded (20)

MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 

Android accessories session 2

  • 2. 13-Nov-13    Roadmap Bluetooth Wi-Fi Sensors       Motion Sensors Position Sensors Environment Sensors Send/ Receive SMS Shared Preference Hands-on Android Accessories Session 3 Tenet Technetronics
  • 3. 13-Nov-13 Bluetooth o o o Which allows a device to wirelessly exchange data with other Bluetooth devices. The application framework provides access to the Bluetooth functionality through the Android Bluetooth APIs. Bluetooth APIs let applications wirelessly connect to other Bluetooth devices. Tenet Technetronics
  • 4. 13-Nov-13 Bluetooth Cont. o o o o o Scan for other Bluetooth devices Query the local Bluetooth adapter for paired Bluetooth devices Establish RFCOMM channels Connect to other devices through service discovery Transfer data to and from other devices Tenet Technetronics
  • 5. 13-Nov-13 Bluetooth Cont. All of the Bluetooth APIs are available in the android. Bluetooth package. The four major tasks necessary to communicate using Bluetooth.     setting up Bluetooth, finding devices that are either paired or available in the local area, connecting devices & transferring data between devices. Tenet Technetronics
  • 6. 13-Nov-13 Bluetooth Cont. The classes and interfaces you will need to create Bluetooth connections:     Bluetooth Adapter. Bluetooth Device. Bluetooth Socket. Bluetooth Server Socket. Tenet Technetronics
  • 7. 13-Nov-13 Bluetooth Permissions. o o We must declare the Bluetooth permission BLUETOOTH. To initiate device discovery or manipulate Bluetooth settings, we must also declare the BLUETOOTH_ADMIN permission. Tenet Technetronics
  • 8. 13-Nov-13 Setting Up Bluetooth Verify that Bluetooth is supported on the device. If Bluetooth is not supported, then disable any Bluetooth features. o o Get the BluetoothAdapter. Enable Bluetooth. Tenet Technetronics
  • 9. 13-Nov-13 Setting Up Bluetooth Get Bluetooth Adapter: The BluetoothAdapter is required for any and all Bluetooth activity. Tenet Technetronics
  • 10. 13-Nov-13 Setting Up Bluetooth Enable Bluetooth. o o Ensure that Bluetooth is enabled. Call isEnabled() to check whether Bluetooth is currently enable. If this method returns false, then Bluetooth is disabled. Tenet Technetronics
  • 11. 13-Nov-13 Finding Devices o o o Find remote Bluetooth devices either through device discovery or by querying the list of paired (bonded) devices. Device discovery is a scanning procedure that searches the local area for Bluetooth enabled devices. A Bluetooth device within the local area will respond to a discovery request only if it is currently enabled to be discoverable Tenet Technetronics
  • 12. 13-Nov-13 Querying paired devices o o Before performing device discovery, its worth querying the set of paired devices. call getBondedDevices(). Tenet Technetronics
  • 13. 13-Nov-13 Discovering devices o o o simply call startDiscovery(). The method will immediately return with a Boolean indicating whether discovery has successfully started. Involves an inquiry scan of about 12 seconds, followed by a page scan of each found device to retrieve its Bluetooth name. Tenet Technetronics
  • 14. 13-Nov-13 Discovering devices o o Register a Broadcast Receiver for the ACTION_FOUND Intent in order to receive information about each device discovered. This Intent carries the extra fields EXTRA_DEVICE and EXTRA_CLASS, containing a BluetoothDevice and a BluetoothClass. Tenet Technetronics
  • 16. 13-Nov-13 Connecting Devices o o To create a connection between two devices, implement both the server-side and client-side mechanisms. If the two devices have not been previously paired, then the Android framework will automatically show a pairing request notification or dialog to the user during the connection procedure. Tenet Technetronics
  • 17. 13-Nov-13 Connecting as a server o o One must act as a server by holding an open BluetoothServerSocket. The server socket is to listen for incoming connection requests.    Get a BluetoothServerSocket by calling the listenUsingRfcommWithServiceRecord(String, UUID). Start listening for connection requests by calling accept(). Unless you want to accept additional connections, call close(). Tenet Technetronics
  • 19. 13-Nov-13 Connecting as a client To initiate a connection with a remote device , obtain the remote device. o Using the Bluetooth Device, get a BluetoothSocket by calling createRfcommSocketToServiceRecord (UUID). Note : The UUID passed here must match the UUID used by the server device when it opened its BluetoothServerSocket o Tenet Technetronics
  • 20. 13-Nov-13 Connecting as a client o o o Initiate the connection by calling connect(). We should always ensure that the device is not performing device discovery when you call connect(). If discovery is in progress, then the connection attempt will be significantly slowed and is more likely to fail. Tenet Technetronics
  • 22. 13-Nov-13 Managing a Connection Once Both Devices are connected  Get the InputStream and OutputStream that handle transmissions through the socket,  Read and write data to the streams. Tenet Technetronics
  • 23. 13-Nov-13 Wi-Fi o o The Primary API for managing all aspects of Wi-Fi connectivity. It deals with several categories of items:    The list of configured networks. The currently active Wi-Fi network. Results of access point scans. Tenet Technetronics
  • 24. 13-Nov-13 Turn On/Off Wi-Fi o o Need to use WiFiManager class. Create an Object of WiFiManager class to get the services of Wi-Fi. Tenet Technetronics
  • 25. 13-Nov-13 Permission in Manifest o When performing Wi-Fi specific operations, we must declare permissions in manifest file Tenet Technetronics
  • 26. 13-Nov-13 Sensors o o Most Android-powered devices have built-in sensors that measure motion, orientation, and various environmental conditions. These sensors are capable of providing raw data with high precision and accuracy, and are useful Tenet Technetronics
  • 27. 13-Nov-13 Sensors The Android platform supports three broad categories of sensors:  Motion sensors (accelerometers, gravity sensors, gyroscopes)  Environmental sensors (pressure, illumination, and humidity)  Position sensors ( orientation sensors and magnetometers) We can access sensors available on the device and acquire raw sensor data by using the Android sensor framework. Tenet Technetronics
  • 28. 13-Nov-13 Sensors We can use the sensor framework to do the following:  Determine which sensors are available on a device.  Determine an individual sensor's capabilities, such as its maximum range, manufacturer, power requirements, and resolution.  Acquire raw sensor data and define the minimum rate at which you acquire sensor data.  Register and unregister sensor event listeners that monitor sensor changes. Tenet Technetronics
  • 29. 13-Nov-13 Identifying Sensors and Sensor Capabilities o o The Android sensor framework provides several methods to determine at runtime which sensors are on a device. To identify the sensors that are on a device you first need to get a reference to the sensor service. Tenet Technetronics
  • 30. 13-Nov-13 Access Sensors: o We can get a listing of every sensor on a device by calling the getSensorList() method Tenet Technetronics
  • 31. 13-Nov-13 Monitoring Sensor Events To monitor raw sensor data you need to implement two callback methods of SensorEventListener interface.  onAccuracyChanged() and  onSensorChanged(). Tenet Technetronics
  • 33. 33 13 November 2013 Send SMS o Add permission in manifest.xml o To send sms we need sms manager. Tenet Technetronics
  • 34. 34 13 November 2013 Send SMS The sendTextMessages() method takes five arguments: o destinationAddress o scAddress o Content of the SMS message o sentIntent o deliveryIntent Tenet Technetronics
  • 35. 35 13 November 2013 Receive SMS o Declare Broadcast receiver in Android Manifest.xml o Give read SMS permission in AndroidManifest o Get the object of SmsManager to find out received sms details Tenet Technetronics
  • 36. 36 13 November 2013 Receive SMS BroadcastReceiver receiver = new BroadcastReceiver() { public void onReceive(Context c, Intent in) { if(in.getAction().equals(RECEIVED_ACTION)) { Bundle bundle = in.getExtras(); if(bundle!=null) { Object[] pdus = (Object[])bundle.get(“pdus”); SmsMessage[] msgs = new SmsMessage[pdus.length]; for(int i = 0; i<pdus.length; i++) { msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]); } // reply(); } } }}; Tenet Technetronics
  • 37. 37 13 November 2013 Shared Preferences o o o o o Android provides several options to save persistent application data Store private primitive data in key-value pairs. Application shared preferences allows you to save and retrieve key, value pair data. Boolean, float, int, long and string. These data will persist even app is killed Tenet Technetronics
  • 38. 38 13 November 2013 Shared Preferences o o Application shared preferences can be fetched using getSharedPreferences() method. We need an editor to edit and save the changes in shared preferences. Tenet Technetronics
  • 39. 39 13 November 2013 Shared Preferences Storing Data: o You can save data into shared preferences using editor. o Call editor. Commit() in order to save changes to shared preferences. Tenet Technetronics
  • 40. 40 13 November 2013 Shared Preferences Retrieving Data o Data can be retrieved from saved preferences by calling getString() (For string) method. Tenet Technetronics
  • 41. 41 13 November 2013 Shared Preferences Clearing / Deleting Data o To delete that particular value, call remove(“key_name”). o If we want to delete all the data, call clear(). Tenet Technetronics