0% found this document useful (0 votes)
29 views2 pages

Response

The document discusses various aspects of implementing GPS and background services in Android apps. It provides guidance on: 1) Using the LocationManager API's requestLocationUpdates() method and adjusting the time and distance properties to optimize battery usage when requesting location updates. 2) Running code that interacts with the Android UI (like showing a toast message) on the main thread using a Handler when working with background services. 3) Securing messages in broadcast receivers by adding a custom permission with android:protectionLevel="signature" so only apps signed with the same key can send broadcasts. 4) Key concepts like Loopers, Handlers, and how they are used to facilitate communication between threads in Android. Garbage collection
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Response

The document discusses various aspects of implementing GPS and background services in Android apps. It provides guidance on: 1) Using the LocationManager API's requestLocationUpdates() method and adjusting the time and distance properties to optimize battery usage when requesting location updates. 2) Running code that interacts with the Android UI (like showing a toast message) on the main thread using a Handler when working with background services. 3) Securing messages in broadcast receivers by adding a custom permission with android:protectionLevel="signature" so only apps signed with the same key can send broadcasts. 4) Key concepts like Loopers, Handlers, and how they are used to facilitate communication between threads in Android. Garbage collection
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Question Guideline Observation

Tell us your Experience in Android - Recent project - Be as Focus mainly in most important Android Projects, and tricky frameworks/libraries used in
technical as you can those projects
Using the Google
Awareness API, you can
Things in mind: Time and distance properties. You can set time and distance properties
enable your app to
that affect how often the device will request a location update. This is accomplished
intelligently react to the
using the overloaded LocationManager.requestLocationUpdates() method. These
What are the things you need to have in mind when user's current situation. The
properties adjust how aggressively the device will request location updates by minimum
implementing the GPS libraries. To improve the Awareness API exposes 7
time elapsed and minimum distance traveled.
resources/usage. Proper way to handle listeners in GPS ? different types of context,
How you adjust these settings significantly affects the battery life. The equation for
including location, weather,
battery life is straightforward and simple: the shorter the minimum time interval the faster
user activity, and nearby
the battery will be drained.
beacons, enabling your app
to refine the user experience https://developer.android.com/tra
We have two type of services: Service and IntentService. The service may not be
running in the same UI context, so to show the toast(interact with the Android UI) we
may need to run it on the same UI thread.

//gets the main thread


Read this link: http://blog.
Handler handler = new Handler(Looper.getMainLooper());
rhesoft.
handler.post(new Runnable() {
How to manipulate Background services and show a message com/2016/03/14/tutorial-
@Override
in current thread? developing-android-
public void run() {
background-services-
// run this code in the main thread
android-studio/
Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
}
});

There are also another way to do it using LocalBroadcastReceivers. We need to register


one in the activity and then send the intent from the service
Add Custom permission with android:protectionLevel="signature" would seem to be the
ideal solution for your problem. No apps will be able to send broadcasts to your receiver
without holding that permission, which can only be held by apps signed by the same more info in https:
How to make sure the messages are secure in the signing key. As a bonus, users do not have to agree to the permission at install time. //manifestsecurity.
broadcaster? Pro tip: define the <permission> element in both the app and the plugin, so the install com/android-application-
order of those two does not matter. Note that custom permissions have a security security-part-18/
flaw prior to Android 5.0, and that on Android 5.0+ no two apps can define the same
permission unless they are signed by the same signing key.
A Looper is a message handling loop: it reads and processes items from a
MessageQueue. The Looper class is usually used in conjunction with a HandlerThread
https://blog.mindorks.
(a subclass of Thread).
com/android-core-looper-
What is looper and what is handler?
handler-and-handlerthread-
A Handler is a utility class that facilitates interacting with a Loopermainly by posting
bd54d69fe91a
messages and Runnable objects to the thread's MessageQueue. When a Handler is
created, it is bound to a specific Looper (and associated thread and message queue).
What is garbage collection? How do you make it happen? Can
video with example: https://www.youtube.com/watch?v=pzfzz50W5Uo
you run it on demand?
anonymous Runnable is holding an implicit reference of the Activity. When the Read here: http://www.
codexpedia.
Activity is destroyed within 10 seconds after its created, it will have a memory
How can you create a memory leak? com/android/memory-leak-
leak becasuse the anonymous runnable is still holding a reference of the activity examples-and-solutions-in-
which caused the activity not being garbage collected. android/
Read 1) https://www.
linkedin.com/pulse/practice-
avoiding-memory-leak-
android-weimin-ding
Have you heard of context association to create a memory
and 2) http://www.
leak?
codexpedia.
com/android/memory-leak-
examples-and-solutions-in-
android/
The arrival of the RecyclerView changed everything. It still uses an Adapter to act as a
What feature is mandatory in the Recycle view and is optional data source; however, you have to create ViewHolders to keep references in memory.
in List view. When you need a new view, it either creates a new ViewHolder object to inflate the
layout and hold those references, or it recycles one from the existing stack.
Singleton is a very common design pattern that is used to have a single instance of an
What is a singleton? object. Also the advantage is that it has global access, it means that any object can http://www.oodesign.com/
communicate with that instance from any part of the app.
A deadlock occurs when a process or thread is waiting for a resource that is held by
What is a deadlock? another process and this process is waiting for a resource that is heild for the first
process. That causes that both processes become inactive
read from here: https://developer.android.com/guide/components/tasks-and-back-stack.
How does STACK, (where you push the activities) work?
html
https://developer.android.
How to make files or data secure? com/training/best-security.
html

And a useful tip from their project:


"In our project the most tricky part is when interacting BLE with different devices"

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy