Notifications
Android Notifications
Notifications អនុញ្ញាតឱ្យ app របស់អ្នកបង្ហាញព័ត៌មានសំខាន់ៗដល់អ្នកប្រើប្រាស់ ទោះបីជា app មិនបានបើកក៏ដោយ។
📱 Notification Components
Component | ពិពណ៌នា |
---|---|
Small Icon | រូបតូច (required) |
Title | ចំណងជើង notification |
Content Text | អត្ថបទនៃ notification |
Large Icon | រូបធំ (optional) |
Actions | ប៊ូតុងសកម្មភាព (optional) |
🔔 បង្កើត Simple Notification
Java Code
Click "Run" to execute the Java code
📋 Notification Channel (Android 8.0+)
ចាប់ផ្តើមពី Android 8.0 (API 26), notifications ត្រូវការ Channel។
Java Code
Click "Run" to execute the Java code
🎯 Notification ជាមួយ Action
Java Code
Click "Run" to execute the Java code
📸 Big Picture Notification
Java Code
Click "Run" to execute the Java code
🔊 Notification Priority
Priority | ពិពណ៌នា |
---|---|
PRIORITY_MIN |
សំខាន់តិចបំផុត (no sound/vibration) |
PRIORITY_LOW |
សំខាន់ទាប |
PRIORITY_DEFAULT |
ធម្មតា (default) |
PRIORITY_HIGH |
សំខាន់ខ្ពស់ (heads-up) |
PRIORITY_MAX |
សំខាន់បំផុត (urgent) |
🎨 Custom Notification
Java Code
Click "Run" to execute the Java code
⚠️ Permission: Android 13+ ត្រូវការ POST_NOTIFICATIONS permission!
Java Code
Click "Run" to execute the Java code
✅ Best Practices
- បង្កើត notification channels សម្រាប់ notification types ផ្សេងៗ
- ប្រើ appropriate priority level
- ផ្តល់ clear និង concise content
- បន្ថែម action buttons សម្រាប់ common tasks
- ប្រើ large icon សម្រាប់ visual appeal
- Test notifications លើ Android versions ផ្សេងៗ