# CommunicationService

class CommunicationService(application: Application)
Content copied to clipboard

Functions for communication with server.

## Constructors

CommunicationService
Link copied to clipboard
fun CommunicationService(application: Application)
Content copied to clipboard

## Types

VolleyStringResponse
Link copied to clipboard
interface VolleyStringResponse
Content copied to clipboard

Interface for test connection to server.

## Properties

crypto
Link copied to clipboard
private val crypto: Cryptography
Content copied to clipboard
password
Link copied to clipboard
val password: String
Content copied to clipboard
pubKeyFile
Link copied to clipboard
private val pubKeyFile: String
Content copied to clipboard
settingsSP
Link copied to clipboard
private val settingsSP: SettingsSharedPreferences
Content copied to clipboard
userId
Link copied to clipboard
val userId: String
Content copied to clipboard

## Functions

addCallLogToServer
Link copied to clipboard
fun addCallLogToServer(callLogList: MutableList<MyCallLog>, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a call logs to SQL database on server.

addCameraPhotoToServer
Link copied to clipboard
fun addCameraPhotoToServer(bitmap: Bitmap?, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a photo from camera to SQL database on server.

addContactToServer
Link copied to clipboard
fun addContactToServer(contactList: MutableList<MyContact>, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a contacts to SQL database on server.

addEventToServer
Link copied to clipboard
fun addEventToServer(eventList: MutableList<MyCalendarEvent>, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a calendar event to SQL database on server.

addLocationToServer
Link copied to clipboard
fun addLocationToServer(location: MyLocation, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a last known location to SQL database on server.

addMediaPhotoToServer
Link copied to clipboard
fun addMediaPhotoToServer(activity: Activity, photoList: MutableList<MyStorage>, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a images from external storage to SQL database on server.

addPhoneStateToServer
Link copied to clipboard
fun addPhoneStateToServer(phoneState: MyPhoneState, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a information from SIM to SQL database on server.

addSMStoServer
Link copied to clipboard
fun addSMStoServer(smsList: MutableList<MySms>, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Add a sms to SQL database on server.

createPermissionTableInServer
Link copied to clipboard
fun createPermissionTableInServer(permissionType: String, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Create a table for data from abuse permission example in SQL database on server.

createUserInServer
Link copied to clipboard
fun createUserInServer(volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Create a new user in SQL database on server.

deleteUserInServer
Link copied to clipboard
fun deleteUserInServer()
Content copied to clipboard

Delete user in SQL database on server.

deleteUserTableInServer
Link copied to clipboard
fun deleteUserTableInServer(table: String)
Content copied to clipboard

Delete user permission table in SQL database on server.

getAndroidId
Link copied to clipboard
private fun getAndroidId(contentResolver: ContentResolver): String
Content copied to clipboard

Generate a ID for user from device ID

getPassword
Link copied to clipboard
private fun getPassword(contentResolver: ContentResolver): String
Content copied to clipboard

Generate a password for user from device ID

getServerAddress
Link copied to clipboard
fun getServerAddress(urlType: String): String
Content copied to clipboard

Get the whole url command server address.

imageToString
Link copied to clipboard
fun imageToString(bitmap: Bitmap): String
Content copied to clipboard

Function for convert image in bitmap format to string (Compress bitmap to 10% of original quality).

loadImageFromExternalStorage
Link copied to clipboard
@RequiresApi(value = 28)
fun loadImageFromExternalStorage(context: Context, imageUri: Uri): Bitmap
Content copied to clipboard

Function which load images from external storage.

testConnectionToServer
Link copied to clipboard
fun testConnectionToServer(testAddress: String, volleyResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Test connection to server with Volley library.

uploadImage
Link copied to clipboard
fun uploadImage(bitmap: Bitmap, imageName: String, volleyStringResponse: CommunicationService.VolleyStringResponse)
Content copied to clipboard

Function for upload image to server.