MoEUtils

class MoEUtils

Author

MoEngage (abhishek@moenegage.com)

Functions

bytesToHex
Link copied to clipboard
open fun bytesToHex(bytes: Array<Byte>): String
convertJsonToAttributeObject
Link copied to clipboard
open fun convertJsonToAttributeObject(attributeJson: JSONObject): MoEAttribute
convertJsonToBundle
Link copied to clipboard
open fun convertJsonToBundle(jsonObject: JSONObject): Bundle
Convert the information contained in a JSONObject into a Bundle
convertMapToBundle
Link copied to clipboard
open fun convertMapToBundle(map: Map<String, String>): Bundle
copyCouponCodeToClipboard
Link copied to clipboard
open fun copyCouponCodeToClipboard(context: Context, couponCode: String)
Copies the specified coupon code to the Clipboard.
copyTextToClipboardAndShowToast
Link copied to clipboard
open fun copyTextToClipboardAndShowToast(context: Context, copyText: String, message: String)
Copies the specified coupon code to the Clipboard.
currentISOTime
Link copied to clipboard
open fun currentISOTime(): String
currentMillis
Link copied to clipboard
open fun currentMillis(): Long
Current time in epoch, milliseconds
currentSeconds
Link copied to clipboard
open fun currentSeconds(): Long
deepCopy
Link copied to clipboard
open fun deepCopy(bundle: Bundle): Bundle
deviceManufacturer
Link copied to clipboard
open fun deviceManufacturer(): String
downloadImageBitmap
Link copied to clipboard
open fun downloadImageBitmap(imageUrl: String): Bitmap
Downloads an image and returns a bitmap object.According to http://developer.android.com/guide/appendix/media-formats.html, the supportedfiletypes are jpg and png.
dumpIntentExtras
Link copied to clipboard
open fun dumpIntentExtras(tag: String, extras: Bundle)
formatAppId
Link copied to clipboard
open fun formatAppId(appId: String): String
getAndroidID
Link copied to clipboard
open fun getAndroidID(context: Context): String
getDataTypeForObject
Link copied to clipboard
open fun getDataTypeForObject(value: Any): DataTypes
getDeviceDimensions
Link copied to clipboard
open fun getDeviceDimensions(context: Context): ViewDimension
getMd5FromString
Link copied to clipboard
open fun getMd5FromString(imageUrl: String): String
getNetworkType
Link copied to clipboard
open fun getNetworkType(context: Context): String
getOperatorName
Link copied to clipboard
open fun getOperatorName(context: Context): String
getRequestId
Link copied to clipboard
open fun getRequestId(): String
getSha1ForString
Link copied to clipboard
open fun getSha1ForString(inputString: String): String
getSystemService
Link copied to clipboard
open fun <T> getSystemService(context: Context, serviceConstant: String): T
getTimeInISO
Link copied to clipboard
open fun getTimeInISO(timeMillis: Long): String
getUserAttributeUniqueId
Link copied to clipboard
open fun getUserAttributeUniqueId(context: Context): String
hasFeature
Link copied to clipboard
open fun hasFeature(context: Context, feature: String): Boolean
hasKeys
Link copied to clipboard
open fun hasKeys(jsonObject: JSONObject): Boolean
deprecated: Use isNullOrEmpty instead
hasPermission
Link copied to clipboard
open fun hasPermission(context: Context, permission: String): Boolean
isDate
Link copied to clipboard
open fun isDate(attributeString: String): Boolean
isDebugBuild
Link copied to clipboard
open fun isDebugBuild(context: Context): Boolean
isEmptyString
Link copied to clipboard
open fun isEmptyString(string: String): Boolean
Checks if the passed String has atleast one character.
isGif
Link copied to clipboard
open fun isGif(imageUrl: String): Boolean
Checks if the given Image url ends with .gif or .
isNullOrEmpty
Link copied to clipboard
open fun isNullOrEmpty(collection: Collection): Boolean
open fun isNullOrEmpty(map: Map): Boolean
isoStringFromSeconds
Link copied to clipboard
open fun isoStringFromSeconds(seconds: Long): String
jsonToBundle
Link copied to clipboard
open fun jsonToBundle(json: JSONObject): Bundle
jsonToMap
Link copied to clipboard
open fun jsonToMap(payloadJson: JSONObject): Map<String, Any>
mapToJson
Link copied to clipboard
open fun mapToJson(map: Map<String, Any>): JSONObject
milliSecondsFromIsoString
Link copied to clipboard
open fun milliSecondsFromIsoString(isoString: String): Long
minutesToMillis
Link copied to clipboard
open fun minutesToMillis(minutes: Long): Long
secondsFromIsoString
Link copied to clipboard
open fun secondsFromIsoString(isoString: String): Long
secondsToMillis
Link copied to clipboard
open fun secondsToMillis(seconds: Long): Long
showCouponDialog
Link copied to clipboard
open fun showCouponDialog(message: String, couponcode: String, context: Context)
showNormalDialogWithOk
Link copied to clipboard
open fun showNormalDialogWithOk(message: String, context: Context)
showToast
Link copied to clipboard
open fun showToast(message: String, context: Context)
Shows a Toast message
trackActivityStates
Link copied to clipboard
open fun trackActivityStates(activityState: String, activityName: String, context: Context)
Call this for tracking activity see and activity stopped onlyNote : Don't call from UI thread.
transformToPx
Link copied to clipboard
open fun transformToPx(context: Context, dp: Double): Int