RichUtils / pyxis.uzuki.live.richutilskt.service / RLocationService

RLocationService

class RLocationService : Service

Types

LocalBinder

inner class LocalBinder : Binder

LocationCallback

interface LocationCallback

Constructors

<init>

RLocationService()

Properties

currentBestLocation

var currentBestLocation: Location?

Functions

getAddressLine

fun Context.getAddressLine(): String

get AddressLine

getCountryName

fun Context.getCountryName(): String

get country name

getGeoCoderAddress

fun Context.getGeoCoderAddress(): List<Address>?

get Address from CurrentBestLocation

getLocality

fun Context.getLocality(): String

get locality

getLocation

fun getLocation(): Unit

get location of user. this service using 3 methods for fetch location. (Mobile, GPS, Sensor)

getPostalCode

fun Context.getPostalCode(): String

get postal code

onBind

fun onBind(intent: Intent?): LocalBinder

onCreate

fun onCreate(): Unit

onDestroy

fun onDestroy(): Unit

onStartCommand

fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int

setLocationCallback

fun setLocationCallback(callback: (Location) -> Unit): Unit
fun setLocationCallback(callback: F1<Location>): Unit

Set callback for location service. any location updates will invoke this callback (except new location data is not-best-location.)

stopUpdates

fun stopUpdates(): Unit

stop location update service

Extension Properties

accessibilityManager

val Context.accessibilityManager: AccessibilityManager

get AccessibilityManager

accountManager

val Context.accountManager: AccountManager

get AccountManager

activityManager

val Context.activityManager: ActivityManager

get ActivityManager

alarmManager

val Context.alarmManager: AlarmManager

get AlarmManager

appOpsManager

val Context.appOpsManager: AppOpsManager

get AppOpsManager

appWidgetManager

val Context.appWidgetManager: AppWidgetManager

get AppWidgetManager

audioManager

val Context.audioManager: AudioManager

get AudioManager

batteryManager

val Context.batteryManager: BatteryManager

get BatteryManager

bluetoothManager

val Context.bluetoothManager: BluetoothManager

get BluetoothManager

cameraManager

val Context.cameraManager: CameraManager

get CameraManager

captioningManager

val Context.captioningManager: CaptioningManager

get CaptioningManager

clipboardManager

val Context.clipboardManager: ClipboardManager

get ClipboardManager

connectivityManager

val Context.connectivityManager: ConnectivityManager

get ConnectivityManager

consumerIrManager

val Context.consumerIrManager: ConsumerIrManager

get ConsumerIrManager

devicePolicyManager

val Context.devicePolicyManager: DevicePolicyManager

get DevicePolicyManager

displayManager

val Context.displayManager: DisplayManager

get DisplayManager

downloadManager

val Context.downloadManager: DownloadManager

get downloadManager

dropBoxManager

val Context.dropBoxManager: DropBoxManager

get DropBoxManager

inputManager

val Context.inputManager: InputManager

get InputManager

inputMethodManager

val Context.inputMethodManager: InputMethodManager

get InputMethodManager

jobScheduler

val Context.jobScheduler: JobScheduler

get JobScheduler

keyguardManager

val Context.keyguardManager: KeyguardManager

get KeyguardManager

launcherApps

val Context.launcherApps: LauncherApps

get LauncherApps

layoutInflater

val Context.layoutInflater: LayoutInflater

get LayoutInflater

locationManager

val Context.locationManager: LocationManager

get LocationManager

mediaProjectionManager

val Context.mediaProjectionManager: MediaProjectionManager

get MediaProjectionManager

mediaRouter

val Context.mediaRouter: MediaRouter

get MediaRouter

mediaSessionManager

val Context.mediaSessionManager: MediaSessionManager

get MediaSessionManager

nfcManager

val Context.nfcManager: NfcManager

get NfcManager

notificationManager

val Context.notificationManager: NotificationManager

get NotificationManager

nsdManager

val Context.nsdManager: NsdManager

get NsdManager

powerManager

val Context.powerManager: PowerManager

get PowerManager

printManager

val Context.printManager: PrintManager

get PrintManager

restrictionsManager

val Context.restrictionsManager: RestrictionsManager

get RestrictionsManager

searchManager

val Context.searchManager: SearchManager

get SearchManager

sensorManager

val Context.sensorManager: SensorManager

get SensorManager

storageManager

val Context.storageManager: StorageManager

get StorageManager

telecomManager

val Context.telecomManager: TelecomManager

get TelecomManager

telephonyManager

val Context.telephonyManager: TelephonyManager

get TelephonyManager

textServicesManager

val Context.textServicesManager: TextServicesManager

get TextServicesManager

tvInputManager

val Context.tvInputManager: TvInputManager

get TvInputManager

uiModeManager

val Context.uiModeManager: UiModeManager

get UiModeManager

usbManager

val Context.usbManager: UsbManager

get UsbManager

userManager

val Context.userManager: UserManager

get UserManager

vibrator

val Context.vibrator: Vibrator

get Vibrator

wallpaperManager

val Context.wallpaperManager: WallpaperManager

get WallpaperManager

wifiManager

val Context.wifiManager: WifiManager

get WifiManager

wifiP2pManager

val Context.wifiP2pManager: WifiP2pManager

get WifiP2pManager

windowManager

val Context.windowManager: WindowManager

get WindowManager

Extension Functions

alert

fun Context.alert(message: String, title: String = "", positiveButton: String? = null, cancelable: Boolean = true, callback: (DialogInterface) -> Unit = {}): Builder

Display AlertDialog instantly

fun Context.alert(message: String, title: String = "", positiveButton: String? = null, cancelable: Boolean = true, callback: F1<DialogInterface>?): Builder

Display AlertDialog instantly for SAM Conversion

applyUnReadCount

fun Context.applyUnReadCount(count: Int): Unit

apply count of UnRead

bitmapToDrawable

fun Context.bitmapToDrawable(bitmap: Bitmap): Drawable

Bitmap to Drawable

browse

fun Context.browse(url: String, newTask: Boolean = false): Boolean

Browse given url with internal browser

checkNetwork

fun Context.checkNetwork(): Int

get network connection check

confirm

fun Context.confirm(message: String, callback: DialogInterface.() -> Unit, title: String = "", positiveButton: String? = null, negativeButton: String? = null, cancelable: Boolean = true): Builder

Display AlertDialog instantly with confirm

fun Context.confirm(message: String, callback: F1<DialogInterface>?, title: String = "", positiveButton: String? = null, negativeButton: String? = null, cancelable: Boolean = true): Builder

Display AlertDialog instantly with confirm for SAM Conversion

copyAssets

fun Context.copyAssets(path: String): Unit

Assets to Internal storage

copyText

fun Context.copyText(text: CharSequence): Unit

copy text to clipboard

createNotificationChannel

fun Context.createNotificationChannel(id: String = "", name: String = "", description: String = "", importance: Int = NotificationManager.IMPORTANCE_HIGH): String

create Notification Channel for Android Oreo and above. every options is optional, if you doesn't matter whatever value, leave them no parameters.

dialCall

fun Context.dialCall(number: String): Boolean

Make phone dial with given phone number

dimen

fun Context.dimen(resource: Int): Int

get pixel size from DimenRes

dip2px

fun Context.dip2px(value: Int): Int
fun Context.dip2px(value: Float): Int

convert dip to px

getAndroidId

fun Context.getAndroidId(): String

get androidId of device

getContactsList

fun Context.getContactsList(): List<ContactItem>

load contact data from device

getExtension

fun Context.getExtension(uri: String?): String

Gets the extension of a file name, like ".png" or ".jpg".

getIMEI

fun Context.getIMEI(): String

get IMEI of device

getImageHeight

fun Context.getImageHeight(resId: Int): Int

get Height of Image which given Drawable Resources

getImageMimeType

fun Context.getImageMimeType(resId: Int): String

get MimeType of Image which given Drawable Resources

getImageWidth

fun Context.getImageWidth(resId: Int): Int

get Width of Image which given Drawable Resources

getKeyHash

fun Context.getKeyHash(): String

get key hash of application

getLine1Number

fun Context.getLine1Number(): String

get Line1Number (as know as PhoneNumber) of device

getMimeType

fun Context.getMimeType(file: File): String

getOutputMediaFile

fun Context.getOutputMediaFile(dateFormat: String = "yyyy-MM-dd HH:mm:ss", format: CompressFormat = Bitmap.CompressFormat.JPEG): File

Generate File object in externalFilesDir

getStatusBarHeight

fun Context.getStatusBarHeight(): Int

get Height of status bar

getTextFromClipboard

fun Context.getTextFromClipboard(): String

get text of clipboard list

getThumbnail

fun Context.getThumbnail(file: File): Bitmap?

Attempt to retrieve the thumbnail of given File from the MediaStore. This should not be called on the UI thread.

fun Context.getThumbnail(uri: Uri): Bitmap?
fun Context.getThumbnail(uri: Uri?, mimeType: String): Bitmap?

Attempt to retrieve the thumbnail of given Uri from the MediaStore. This should not be called on the UI thread.

getVideoDuration

fun Context.getVideoDuration(videoId: String): Long

get Duration of Video from MediaStore.Video with given videoId

getVideoFileId

fun Context.getVideoFileId(videoPath: String): String

get id from MediaStore.Video with given videoPath

getVideoThumbsPath

fun Context.getVideoThumbsPath(videoId: String): String

get Path of Thumbnail from MediaStore.Video with given videoId

inflate

fun Context.inflate(layoutRes: Int, parent: ViewGroup? = null, attachToRoot: Boolean = false): View

inflate view

isConnected

fun Context.isConnected(): Boolean

isMobileConnected

fun Context.isMobileConnected(): Boolean

get Mobile connection check

isNotConnected

fun Context.isNotConnected(): Boolean

get state of not connected

isProcessRunning

fun Context.isProcessRunning(): Boolean

get boolean value for whatever application process is running

isWifiConnected

fun Context.isWifiConnected(): Boolean

get Wifi connection check

makeCall

fun Context.makeCall(number: String): Boolean

Make phone call with given phone number

progress

fun Context.progress(message: String, cancelable: Boolean = true, title: String = ""): DialogInterface

Display ProgressDialog

px2dip

fun Context.px2dip(px: Int): Float

convert px to dip

px2sp

fun Context.px2sp(px: Int): Float

convert px to sp

reboot

fun Context.reboot(restartIntent: Intent = this.packageManager.getLaunchIntentForPackage(this.packageName)): Unit

Reboot application

removeUnReadCount

fun Context.removeUnReadCount(): Unit

remove count of UnRead

requestMediaScanner

fun Context.requestMediaScanner(url: String): Unit

Request MediaScanning

saveBitmapToFile

fun Context.saveBitmapToFile(bitmap: Bitmap, dateFormat: String = "yyyy-MM-dd HH:mm:ss", format: CompressFormat = Bitmap.CompressFormat.JPEG, quality: Int = 100): File?

Save Bitmap to generated File

selector

fun <T> Context.selector(items: List<T>, callback: (DialogInterface, item: T, Int) -> Unit, title: String = "", cancelable: Boolean = true): Builder

Display SelectorDialog instantly

fun <T> Context.selector(items: List<T>, callback: F3<DialogInterface, T, Int>?, title: String = "", cancelable: Boolean = true): Builder

Display SelectorDialog instantly for SAM Conversion

setTypeface

fun Context.setTypeface(layoutRes: Int, parent: ViewGroup? = null, isAttachedRoot: Boolean = false): View?
fun Context.setTypeface(view: ViewGroup, parent: ViewGroup? = null, isAttachedRoot: Boolean = false): View?

Set system font into ViewGroup

sp2px

fun Context.sp2px(value: Int): Int
fun Context.sp2px(value: Float): Int

convert sp to px

toast

fun Context.toast(message: String, length: Int = Toast.LENGTH_SHORT): Unit
fun Context.toast(message: Int, length: Int = Toast.LENGTH_SHORT): Unit

Display Toast Message

toggleKeyboard

fun Context.toggleKeyboard(): Unit

toggle keyboard open / close

versionCode

fun Context.versionCode(): Int

get version code of this application

versionName

fun Context.versionName(): String

get version name of this application

vibrate

fun Context.vibrate(millSec: Long): Unit
fun Context.vibrate(pattern: LongArray, repeat: Int = -1): Unit

Vibrate need VIBRATE permission