Institute of Computer Science
  1. Courses
  2. 2020/21 fall
  3. Mobile Computing and Internet of Things (LTAT.06.009)
ET
Log in

Mobile Computing and Internet of Things 2020/21 fall

  • Main
  • Lectures
  • Labs
  • Homeworks & Home Assignments
  • Quizes
  • Task submission
  • Extra Materials
  • Projects
    • Teams & Topics
    • Presentations & Report
    • Grading & Submission

Call Log App

This homework builds upon the project started in Lab 4. You should complete the lab before proceeding.

1. Permission requests (2 pts)

Update your app to properly request permissions from the user when first started.

  • First check if required permissions are already granted
    • If yes, register the receiver
    • If not, request for them and register the receiver once they have been granted

Important! Study the permissions developer guide for more instructions. In lecture 4, usage of ActivityCompat.requestPermissions(..) and onRequestPermissionsResult(..) was demonstrated. In the guide linked above, 2 ways of doing it are described:

  • Using RequestPermission and letting the system manage request codes, which requires you to introduce an additional library to your poject
  • Using the approach where you manage request codes yourself, as shown in lecture 4. For this, no additional dependencies are needed.

You may use either of those approaches.


2. "Call Back" functionality with RecyclerView & Adapter

As in the 3rd part of Lab 4, show the list of calls in a RecyclerView.

  • Modify the custom_list_item.xml so that its root is a horizontal LinearLayout, containing:
    • 2 TextViews (for displaying phone number and the incoming call timestamp)
    • An ImageView or Button with the text "Call" (choose one of the 2).
  • Adjust the behaviour of your RecyclerView Adapter:
    • One TextView displays the phone number, as in lab 4 (1pt)
    • The second TextView displays the time when the phone started ringing (hours, minutes, seconds).(1pt)
    • Set up a click listener for the ImageView/Button, so that it is clicked, a new Intent to start a phone dialer Activity is launched, with the number filled in. ( 1 pt)
      • Use Intent.ACTION_DIAL
      • Tip: you can use your View object from the ViewHolder to get an instance of Context
      • You have to specify the correct Uri for a phone number
      • For more info on initiating calls, including Uri examples: https://developer.android.com/guide/components/intents-common#Phone
  • By default, the PHONE_STATE_CHANGED broadcast is delivered more than once per each incoming call. Adjust the code so that the per each call, only 1 item is added.
    • You can do this by tracking the state changes of the broadcasts, for example. Only add an item to the list if the previous state was idle and new state is ringing.
    • Other solutions are also fine, as long as duplicate entries are not made for a single call.
  • Institute of Computer Science
  • Faculty of Science and Technology
  • University of Tartu
In case of technical problems or questions write to:

Contact the course organizers with the organizational and course content questions.
The proprietary copyrights of educational materials belong to the University of Tartu. The use of educational materials is permitted for the purposes and under the conditions provided for in the copyright law for the free use of a work. When using educational materials, the user is obligated to give credit to the author of the educational materials.
The use of educational materials for other purposes is allowed only with the prior written consent of the University of Tartu.
Terms of use for the Courses environment