Location Service and Sensors

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 4 Overview Overview of Sensors Programming Tutorial 1: Tracking location with GPS and Google.
Advertisements

Programming with Android: System Services Luca Bedogni Marco Di Felice Dipartimento di Scienze dell’Informazione Università di Bologna.
Sensors.  Hardware devices that take measurements of the physical environment  Some examples  3-axis Accelerometer  3-axis Magnetic field sensor 
Location & Maps.  Mobile applications can benefit from being location-aware, e.g.,  Routing from a current to a desired location  Searching for stores.
Cosc 5/4730 Input Keyboard, touch, and Accelerometer.
Android wifi-based localization. Localization types Android allows (location providers) – GPS (GPS_PROVIDER) – Cell tower + wifi (NETWORK_PROVIDER) You.
Introduction to Smartphone Sensors
Location and Maps Content Getting Location Getting Google Map In application Test on Emulator/Device.
Android sensors.
Cosc 5/4730 GPS/Location android.location. Simulator notes All the simulators can simulator GPS/location information – Android DDMS commands (geo) to.
CS378 - Mobile Computing Location.
CS378 - Mobile Computing Sensing and Sensors. Sensors "I should have paid more attention in Physics 41" Most devices have built in sensors to measure.
CS378 - Mobile Computing Sensing and Sensors. Sensors "I should have paid more attention in Physics 41" Most devices have built in sensors to measure.
Map Applications.
Android Sensors & Async Callbacks Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Introduction to Mobile Sensing with Smartphones Uichin Lee April 22, 2013.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
Getting Started with Android APIs Ivan Wong. Motivation - “Datasheet” - Recently exposed to what’s available in Android - So let’s see what API’s are.
Cosc 5/4730 Input Keyboard, touch, and Accelerometer.
Mobile Application Development Selected Topics – CPIT 490
Lecture # 9 Hardware Sensor. Topics 2  SensorManger & Sensor  SensorEvent & SensorEventListener  Example Application.
Mobile Programming Lecture 9 Bound Service, Location, Sensors, IntentFilter.
1 Localization and Sensing Nilanjan Banerjee Mobile Systems Programming (Acknowledgement: Jules White) University of Arkansas Fayetteville, AR
Sensing. Possible sensors on devices – Documented in SensorEvent class Accelerometer (m/s 2 ) – acceleration in x, y, z axes Magnetic Field (micro Tesla)
Android Accessing GPS Ken Nguyen Clayton State University 2012.
1 CMSC 628: Introduction to Mobile Computing Nilanjan Banerjee Introduction to Mobile Computing University of Maryland Baltimore County
Sensors – Part I SE 395/595.
로봇을 조종하자 3/4 UNIT 17 로봇 SW 콘텐츠 교육원 조용수. 학습 목표 스마트 폰의 센서를 사용할 수 있다. 2.
Location. GPS Global Positioning System – At least 4 satellites typically used 3 required extra for error detection and altitude typically accurate within.
Maps Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License.
GABRIELLI Adrian PREDA Marius
Augmented Reality Engine Viewlity. About me CristianAndreica 4 th Year student – Politehnica University of Bucharest Co-founder of XTWIP.com Currently.
Sensors – Part 2 SE 395/595. Location in Android LocationManager class – Configure providers and their listeners LocationListener class – Handles update.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors Date: Feb 11, 2016.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
CPE 490/590 – Smartphone Development
Android Fundamentals. What is Android Software stack for mobile devices Software stack for mobile devices SDK provides tools and APIs to develop apps.
Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, WEB:
CS371m - Mobile Computing Sensing and Sensors.
1. 2 Android location services Determining a device’s current location Tracking device movements Proximity alerts.
Location-Based Services. Objectives How to display Google Maps in your application How to control displayed maps How to perform geocoding and reverse.
CS499 – Mobile Application Development Fall 2013 Location & Maps.
Android Android Sensors Android Sensors: – Accelerometer – Gravity sensor – Linear Acceleration sensor – Magnetic Field sensor – Orientation.
Sensors in Android.
Vijay Kumar Kolagani Dr. Yingcai Xiao
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors
Lecture 5: Location Topics: Google Play Services, Location API.
Mobile Software Development for Android - I397
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors.
Designing Apps Using The WebView Control
What's Happening Today Working with Images
Android Location Based Services
Sensors, maps and fragments:
Vijay Kumar Kolagani Dr. Yingcai Xiao
Reactive Android Development
CS499 – Mobile Application Development
Mobile Device Development
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Proposed Solution To Parts Of
Lecture 4: Sensors Topics: Motion, Position, and Environmental Sensors.
CIS 493/EEC 492 Android Sensor Programming
CIS 470 Mobile App Development
Lecture 5: Location Topics: Google Play Services, Location API.
Mobile Programming Sensors in Android.
CS378 - Mobile Computing Location and Maps.
Maps, Geocoding, and Location-Based Services.
External Services CSE 5236: Mobile Application Development
Mobile Programming Broadcast Receivers.
Presentation transcript:

Location Service and Sensors Permissions Location Service Sensors

Permissions (1) AndroidManifest.xml to define permissions Location Services <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/> Networks <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> External Storage <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">

Permissions (2) Camer and Audio Other permissions <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO"/> Other permissions http:developer.android.com/reference/android/Manifest.permission.ht ml

Location Service(1) Android provides Wifi and GPS Location Service Location Service is a System Service LocationManager LM; Location lo; LM=(LocationManager) (this.getSystemService(Context.LOCATION_SERVICE)); if (LM.isProviderEnabled(LocationManager.GPS_PROVIDER)) lo = LM.getLastKnownLocation(LocationManager.GPS_PROVIDER); else if ( LM.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) lo = LM.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); else lo=null;

Location Service(2) Using Location Object to get Location detail http://developer.android.com/reference/android/location/Location.html double Latitude=0,Longitude=0,Accuracy=0; if (lo!=null) { Latitude=lo.getLatitude(); Longitude=lo.getLongitude(); Accuracy=lo.getAccuracy(); ptime.setText(" "+Latitude+" "+Longitude+" "+Accuracy); } else ptime.setText(" no location!");

Location Service(3) Using Listener to monitor Location data LocationManger.requestLocationUpdates( LocationManager.GPS_PROVIDER, time, dist, LL); Methods of LocationListener public void onLocationChanged(Location lo){} public void onProviderDisabled(String provider){} public void onProviderEnabled(String provider){} public void onStatusChanged(String provider,int status, Bundle extras){}

Sensors(1) Sensor Services are System Services SensorManager SM = (SensorManager) getSystemService(SENSOR_SERVICE); Register Sensor Event Listener List sensors = SM.getSensorList(Sensor.TYPE_ALL); int i;Sensor sn; for (i=0;i<sensors.size();i++) {sn=(Sensor) sensors.get(i); if (sn.getType()==Sensor.TYPE_ACCELEROMETER) { SM.registerListener(this, (Sensor) sensors.get(i), SensorManager.SENSOR_DELAY_GAME); //SENSOR_DELAY_NORMAL SENSOR_DELAY_GAME SENSOR_DELAY_FASTEST SENSOR_DELAY_UI SENSOR_DELAY_GAME }

Sensors(2) Methods of SensorEventListener public void onAccuracyChanged(Sensor sensor, int accuracy) int mgValues=new int[3]; int acValues=new int[3]; public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) mgValues = event.values; else if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) acValues = event.values; else return; }