Background Matching Service
A Service running in the background, which detects when new photos are taken on the smartphone. A ContentObserver monitors changes in the phone gallery directory and sends match requests once new photos are detected.
Constructors
Types
Functions
Calculates the inSampleSize for the bitmap decoding.
Creates a notification channel for the foreground notification as well as the notification itself.
Creates the notification channel for the foreground notification.
Creates a notification channel for the match notification as well as the notification itself.
Creates the notification channel for the match notification.
Returns the icon representing the corresponding connected status.
Returns the string representing the corresponding connected status.
Returns the matching options for the match request.
Returns the file path of a given uri.
Checks whether a given file is a new camera photo.
Checks whether a given path is a valid file path.
On destroy, calls stopService.
Called when CaptureCallback.onMatchResult of captureCallback is called. Sends a notification to the user with the result of the matching by calling sendMatchNotification.
Rescales an image to 512x512 and calls sendCaptureRequest with the scaled image.
Send a match notification to the user with the result of the matching process.
Sleeps the service. Called when the screen is turned off.
Initializes contentObserver and registers it.
Starts the service.
Stops the service. Called when the service is destroyed.
Updates the foreground notification with the new connected status.
Updates the match notification with the new image of the match.
Properties
BroadcastReceiver instance, which receives broadcasts from the system (screen on/off).
CaptureCallback object that is used to handle the response from the server. Used in rescaleAndSendToServer.
Instance of ContentObserver which monitors changes in the phone gallery directory and sends match requests once new photos are detected.
Observer instance, which observes ServerConnectionModel.isConnected and updates isConnected accordingly.
Stores the last 10 files dispatched by contentObserver. This is done to avoid double processing, because contentObserver sometimes fires multiple identical events per file.
SharedPreferences instance, stores the preferences.