You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
6.0 KiB
6.0 KiB
Reboot Testing Steps for DailyNotification Plugin
🎯 Objective
Test that scheduled notifications survive device reboots and are properly restored by the BootReceiver.
⏰ Extended Testing Time
- Notification Delay: 5 minutes (instead of 1 minute)
- More Realistic: Allows time for proper testing and verification
- Better for Reboot Testing: Gives time to reboot and verify recovery
🔄 Complete Reboot Testing Procedure
Step 1: Schedule Notification
# Launch app
adb shell am start -n com.timesafari.dailynotification/.MainActivity
- Tap "Test Notification" button
- Verify message: "Notification scheduled for [time]! Check your notification bar in 5 minutes."
- Note the scheduled time (5 minutes from now)
Step 2: Verify Initial Scheduling
# Check scheduled alarms
adb shell "dumpsys alarm | grep timesafari"
- Should show scheduled alarm with correct timestamp
- Note the alarm details
Step 3: Reboot Device
# Reboot device
adb reboot
- Wait 2-3 minutes for device to fully boot
- Wait for boot animation to complete
- Wait for home screen to appear
Step 4: Verify Boot Recovery
# Check recovery logs
adb logcat -d | grep -i "bootreceiver\|recovery"
Look for these log messages:
"Device boot completed - restoring notifications"
"Found X notifications to recover"
"Notification recovery completed: X/X recovered"
Step 5: Verify Alarm Restoration
# Check if alarm was restored
adb shell "dumpsys alarm | grep timesafari"
- Should show the same scheduled alarm as before reboot
- Alarm timestamp should match original schedule
Step 6: Wait for Notification
- Wait for the originally scheduled time (5 minutes from when you scheduled it)
- Check notification panel for the test notification
- Verify notification appears with correct content
🧪 Automated Reboot Test
Run the Reboot Test Script:
# Run automated reboot test
./scripts/reboot-test.sh
What the script does:
- ✅ Checks boot receiver registration
- 📅 Prompts you to schedule notification
- 🔍 Verifies initial scheduling
- 🔄 Reboots device automatically
- ⏳ Waits for boot completion
- 🔍 Checks recovery logs
- ⏰ Verifies alarm restoration
- 🎉 Reports success/failure
🔍 Key Log Messages to Look For
Successful Recovery:
BootReceiver: Device boot completed - restoring notifications
BootReceiver: Found X notifications to recover
BootReceiver: Recovered notification: [notification-id]
BootReceiver: Notification recovery completed: X/X recovered
Recovery Issues:
BootReceiver: No notifications to recover
BootReceiver: Failed to recover notification: [notification-id]
BootReceiver: Error during boot recovery
🚨 Troubleshooting Reboot Recovery
Issue 1: Boot Receiver Not Triggered
Symptoms: No recovery logs after reboot Solutions:
# Check boot receiver registration
adb shell "dumpsys package com.timesafari.dailynotification | grep -A10 -B10 receiver"
# Check BOOT_COMPLETED permission
adb shell "dumpsys package com.timesafari.dailynotification | grep permission"
Issue 2: Recovery Fails
Symptoms: Recovery logs show errors Solutions:
# Check notification storage
adb shell "run-as com.timesafari.dailynotification ls -la /data/data/com.timesafari.dailynotification/shared_prefs/"
# Check alarm permissions
adb shell "dumpsys alarm | grep SCHEDULE_EXACT_ALARM"
Issue 3: Alarms Not Restored
Symptoms: No alarms after recovery Solutions:
# Check exact alarm permissions
adb shell "dumpsys alarm | grep SCHEDULE_EXACT_ALARM"
# Check battery optimization
adb shell "dumpsys deviceidle | grep timesafari"
📊 Success Criteria
✅ Test Passes When:
- Boot receiver is triggered after reboot
- Recovery logs show successful restoration
- Alarms are rescheduled correctly
- Notification appears at the originally scheduled time
- All recovery log messages are present
❌ Test Fails When:
- Boot receiver is not triggered
- Recovery fails with errors
- Alarms are not restored
- Notification doesn't appear
- Recovery logs show failures
🎯 Quick Test Commands
One-Line Reboot Test:
# Schedule notification, reboot, and verify
adb shell am start -n com.timesafari.dailynotification/.MainActivity && echo "Schedule notification, then:" && read -p "Press Enter to reboot..." && adb reboot && sleep 120 && adb logcat -d | grep -i "bootreceiver\|recovery"
Check Recovery Status:
# Quick recovery check
adb logcat -d | grep -i "bootreceiver" | tail -10
Verify Alarms:
# Quick alarm check
adb shell "dumpsys alarm | grep timesafari"
🔧 Advanced Testing
Test Multiple Reboots:
# Test multiple reboot cycles
for i in {1..3}; do
echo "Reboot test $i/3"
./scripts/reboot-test.sh
sleep 60
done
Test with Different Notification Types:
- Test with sound enabled/disabled
- Test with different priorities
- Test with different content
- Test with multiple notifications
Test Edge Cases:
- Test with low battery
- Test with airplane mode
- Test with timezone changes
- Test with system updates
📱 Production Considerations
Real-World Scenarios:
- Users rarely force-stop apps
- Device reboots are common (updates, crashes, etc.)
- App updates should preserve notifications
- Battery optimization can affect recovery
Best Practices:
- Test on multiple Android versions
- Test on different OEMs
- Test with various battery optimization settings
- Test under different network conditions
🎉 Expected Results
After implementing the reboot recovery system:
- Notifications survive reboots ✅
- Boot receiver activates automatically ✅
- Recovery logs show success ✅
- Alarms are properly restored ✅
- Notifications appear at scheduled times ✅
The system is now robust and production-ready! 🚀