Alex Chen

30 code snips · on codesnips 5 months

Senior Android Developer specializing in Kotlin, Jetpack Compose, and modern Android architectures. Expert in building scalable, performant apps with clean architecture. 10+...

kotlin
package com.example.myapp.utils

import android.os.Build
import android.os.StrictMode
import android.os.Trace
import timber.log.Timber

Performance optimization and profiling

kotlin android performance
by Alex Chen 2 tabs
pro
# Keep line numbers for crash reports
-keepattributes SourceFile,LineNumberTable
-renamesourcefileattribute SourceFile

# Keep data classes
-keep class com.example.myapp.models.** { *; }

ProGuard and R8 code optimization

kotlin android proguard
by Alex Chen 2 tabs
kotlin
package com.example.myapp.ui

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

Deep linking and App Links

kotlin android deep-linking
by Alex Chen 2 tabs
kotlin
package com.example.myapp.billing

import android.app.Activity
import android.content.Context
import com.android.billingclient.api.*
import kotlinx.coroutines.flow.MutableStateFlow

In-app billing with Google Play

kotlin android billing
by Alex Chen 1 tab
kotlin
package com.example.myapp.services

import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.Service

Service and foreground notifications

kotlin android service
by Alex Chen 1 tab
kotlin
package com.example.myapp.utils

import android.app.NotificationChannel
import android.app.NotificationChannelGroup
import android.app.NotificationManager
import android.app.PendingIntent

Notification channels and categories

kotlin android notifications
by Alex Chen 1 tab
kotlin
package com.example.myapp.widget

import android.app.PendingIntent
import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider
import android.content.Context

App widgets for home screen

kotlin android widget
by Alex Chen 2 tabs
kotlin
package com.example.myapp.receivers

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter

Broadcast Receivers for system events

kotlin android broadcastreceiver
by Alex Chen 2 tabs
kotlin
package com.example.myapp.ui

import androidx.lifecycle.*
import kotlinx.coroutines.launch

class UserViewModel(

LiveData transformations and mediators

kotlin android livedata
by Alex Chen 1 tab
kotlin
package com.example.myapp.ui.custom

import android.content.Context
import android.util.AttributeSet
import android.view.ViewGroup
import kotlin.math.max

Custom ViewGroup for advanced layouts

kotlin android custom-view
by Alex Chen 2 tabs
kotlin
package com.example.myapp.utils

import android.app.DownloadManager
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent

Download Manager for file downloads

kotlin android downloadmanager
by Alex Chen 1 tab
kotlin
package com.example.myapp.utils

import android.content.Context
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
import androidx.core.content.ContextCompat

Biometric authentication implementation

kotlin android biometric
by Alex Chen 2 tabs