This shows you the differences between two versions of the page.
|
osp:lectures:lecture-connectivity [2016/11/02 15:07] vlad.traista [Practical] |
osp:lectures:lecture-connectivity [2016/11/06 18:57] (current) laura.gheorghe [Lecture] |
||
|---|---|---|---|
| Line 9: | Line 9: | ||
| *{{:osp:lectures:lecture-connectivity.pdf | Lecture Slides}} | *{{:osp:lectures:lecture-connectivity.pdf | Lecture Slides}} | ||
| + | *{{:osp:lectures:5.connectivity_notes.pdf | Lecture Notes}} | ||
| {{url>http://ocw.cs.pub.ro/courses/_media/osp/lectures/lecture-connectivity.pdf}} | {{url>http://ocw.cs.pub.ro/courses/_media/osp/lectures/lecture-connectivity.pdf}} | ||
| Line 76: | Line 77: | ||
| </note> | </note> | ||
| - | === Task 2 - Getting the current location (1p) === | + | === Task 2 - Getting the current location (2p) === |
| For this task, you will need to have enabled either the GPS of your mobile device or an active WiFi connection (or both). | For this task, you will need to have enabled either the GPS of your mobile device or an active WiFi connection (or both). | ||
| Line 82: | Line 83: | ||
| On Android, the location can be gathered using three providers: | On Android, the location can be gathered using three providers: | ||
| * GPS provider which uses the GPS driver of your mobile device to track your connection (it is slow and not very precise) | * GPS provider which uses the GPS driver of your mobile device to track your connection (it is slow and not very precise) | ||
| - | * network provider which relies on having an active internet connection (it has high levels of accuracy) | + | * network provider which relies on having an active Internet connection (it has high levels of accuracy) |
| * passive provider which relies on having the current location determined by other applications | * passive provider which relies on having the current location determined by other applications | ||
| Line 90: | Line 91: | ||
| In order to get the current location, the main activity will have to implement the [[https://developer.android.com/reference/android/location/LocationListener.html|LocationListener]] interface which provides methods for detecting when the location has changed or when a location provider has been enabled or disabled. | In order to get the current location, the main activity will have to implement the [[https://developer.android.com/reference/android/location/LocationListener.html|LocationListener]] interface which provides methods for detecting when the location has changed or when a location provider has been enabled or disabled. | ||
| - | Getting the location requires sending a request to the location providers to determine the current location. The request is sent using a [[https://developer.android.com/reference/android/location/LocationManager.html|LocationManager]] object. Make sure to send a request for every active network provider. Th request will also need a time between updates and a minimum distance to be considered for updating the location. Set these values to 10 minutes and 50 meters. These requests will be sent upon clicking the button. | + | Getting the location requires sending a request to the location providers to determine the current location. The request is sent using a [[https://developer.android.com/reference/android/location/LocationManager.html|LocationManager]] object. Make sure to send a request for every active network provider. The request will also need a time between updates and a minimum distance to be considered for updating the location. Set these values to 1 minute and 5 meters. These requests will be sent upon clicking the button. |
| The LocationListener interface offers a callback through which the user can perform operations if the location coordinates have changed. Implement this callback to set the text of the TextView object to the current coordinates. | The LocationListener interface offers a callback through which the user can perform operations if the location coordinates have changed. Implement this callback to set the text of the TextView object to the current coordinates. | ||
| Line 195: | Line 196: | ||
| * one that stops the Bluetooth alarm | * one that stops the Bluetooth alarm | ||
| - | === Task 5 - Scaning for WiFi devices periodically (4p) === | + | === Task 5 - Scaning for WiFi devices periodically (3p) === |
| In a similar fashion to Task 3 and Task 4, implement an alarm manager that periodically scans the WiFi network for WiFi devices and prints their MAC address. (Hint: [[https://developer.android.com/reference/android/net/wifi/WifiManager.html|WiFiManager]]). | In a similar fashion to Task 3 and Task 4, implement an alarm manager that periodically scans the WiFi network for WiFi devices and prints their MAC address. (Hint: [[https://developer.android.com/reference/android/net/wifi/WifiManager.html|WiFiManager]]). | ||