Differences

This shows you the differences between two versions of the page.

Link to this comparison view

fss:sessions:session2-android [2019/06/26 13:33]
beniamin.dobre
fss:sessions:session2-android [2019/07/04 16:01] (current)
adriana.draghici [Session 2: Android Server Communication & Security]
Line 1: Line 1:
  
-====== Session 2: Android ​Server Communication & Security ======+====== ​Android ​Session 2: Server Communication & Security ======
  
 ===== Objectives ===== ===== Objectives =====
-  * Learn to make secure network calls+  * Learn to make secure network calls using the Retrofit network library
   * Learn how to use a RecyclerView List and a Dialog   * Learn how to use a RecyclerView List and a Dialog
-  * Learn how to use an API using the Retrofit network library+  * Learn how to interact with a public ​API 
  
 ===== Prerequisites ===== ===== Prerequisites =====
Line 120: Line 120:
  
 ===== Tasks ===== ===== Tasks =====
 +  * **Fix the Crash when starting the app.**
 +
   * **Get and display the age of the employee:** In the example provided in the zip file the "​employee_age"​ field is not parsed from the response we get in the requests. Add the necessary code in the EmployeeData class to get it and also display it in the RecyclerView   * **Get and display the age of the employee:** In the example provided in the zip file the "​employee_age"​ field is not parsed from the response we get in the requests. Add the necessary code in the EmployeeData class to get it and also display it in the RecyclerView
-Hint: In order to display it you will have to add a TextView in the list_item_layout.xml and manage it in the MyListAdapter ​+<spoiler Hint: how to display the age>Hint: In order to display it you will have to add a TextView in the list_item_layout.xml and manage it in the MyListAdapter ​</​spoiler>​ 
   * **Make a Delete entry request:** You will need to add a new method in the EmployeeServiceApi and make the Retrofit call in the MainActivity.   * **Make a Delete entry request:** You will need to add a new method in the EmployeeServiceApi and make the Retrofit call in the MainActivity.
  
-<​code>​ +  * //**Bonus Task:**// When pressing the Floating Add Button open a form screen ​(could be a Dialog or a new Activitywith the fields needed ​to create a Employee. On pressing a "​Save"​ button create ​the Retrofit Call to add the new entry   ​
-Call<​ResponseBody>​ responseCallback = apiService.deleteEmployeeById(employeeId);​ +
-        responseCallback.enqueue(new Callback<​ResponseBody>​(+
-            @Override +
-            public void onResponse(Call<​ResponseBody>​ call, Response<​ResponseBody>​ response) { +
-                // Get the employee list again to validate if the entry was deleted +
-                getAllEmployees();​ +
-            }+
  
-            @Override +  * //**Bonus Task:**// Add fingerprint login to the app. See [[https://​developer.android.com/​topic/​security/​best-practices#​ask-for-credentials|Fingerprint login]] for details on how you can do it
-            public void onFailure(Call<​ResponseBody>​ call, Throwable t) { +
-                ​// Show a Failure message +
-            } +
-        }); +
-</code>+
  
-  ​* //**Bonus Task:​**// ​When pressing ​the Floating Add Button open a form screen (could be a Dialog or a new Activity) with the fields needed to create ​Employee. On pressing a "​Save"​ button create the Retrofit Call to add the new entry   + 
 +  ​* //**Bonus Task:​**// ​Check the connectivity to the Internet and display ​message when not connected
  
 ===== Resources ===== ===== Resources =====
 +  - [[https://​drive.google.com/​open?​id=1_plcVwNmo0S8OoBBa90Wwfvmbx-IZZ8J|Slides]]
   - [[https://​ocw.cs.pub.ro/​courses/​smd/​laboratoare/​index|Android Labs for SMD course]] - created in Spring 2019 by Fitbit developers   - [[https://​ocw.cs.pub.ro/​courses/​smd/​laboratoare/​index|Android Labs for SMD course]] - created in Spring 2019 by Fitbit developers
   - [[https://​square.github.io/​retrofit/​|Retrofit Main Page Link]] - A type-safe HTTP client for Android and Java   - [[https://​square.github.io/​retrofit/​|Retrofit Main Page Link]] - A type-safe HTTP client for Android and Java
   - [[http://​dummy.restapiexample.com/​|Public API]] Public API used in this Session   - [[http://​dummy.restapiexample.com/​|Public API]] Public API used in this Session
   - [[https://​developer.android.com/​guide/​topics/​ui/​layout/​recyclerview|RecyclerView List]] RecyclerView Android Documentation   - [[https://​developer.android.com/​guide/​topics/​ui/​layout/​recyclerview|RecyclerView List]] RecyclerView Android Documentation
 +
 +
 +===== Files =====
 +{{:​fss:​sessions:​lab-2-android-retrofit.zip|}}
fss/sessions/session2-android.1561545239.txt.gz · Last modified: 2019/06/26 13:33 by beniamin.dobre
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0