How ihsibo/personalized-ai-notifications works
Personalized AI Notifications is an Android library for generating personalized push-notification text, with a demo app and optional scheduled delivery. The principal flow is app input → library configuration and prompt construction → selected AI provider → success/error result; the background path schedules work, checks frequency, generates text, then displays a notification. The README documents tone, locale, crash context, provider choice, and A/B variants. Source excerpts support the main calls; unsampled cache behavior and some provider dispatch details are not expanded.
Main entry points: NotificationAI.kt Notification API · NotificationWorker.kt Notification worker · MainActivity.kt Demo controls · OpenAIClient.kt OpenAI client
Components 23
Demo app
- Demo controls
app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt
Generation API
- Notification API
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Prompt builder
notificationsAI/src/main/java/com/rounds/notificationsAI/PromptBuilder.kt - Generation config
notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationConfig.kt - Generation result
notificationsAI/src/main/java/com/rounds/notificationsAI/models/NotificationResult.kt - Provider options
notificationsAI/src/main/java/com/rounds/notificationsAI/models/AIProvider.kt - Notification cache
notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationCache.kt
AI providers
- Client contract
notificationsAI/src/main/java/com/rounds/notificationsAI/api/AIClient.kt - OpenAI client
notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt - Gemini client
notificationsAI/src/main/java/com/rounds/notificationsAI/api/GeminiClient.kt - Hugging Face client
notificationsAI/src/main/java/com/rounds/notificationsAI/api/HuggingFaceClient.kt - Ollama client
notificationsAI/src/main/java/com/rounds/notificationsAI/api/OllamaClient.kt - OpenAI payload models
notificationsAI/src/main/java/com/rounds/notificationsAI/models/OpenAIModels.kt
Background delivery
- Work scheduler
notificationsAI/src/main/java/com/rounds/notificationsAI/background/BackgroundNotificationScheduler.kt - Boot receiver
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationBootReceiver.kt - Notification worker
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt - Frequency tracker
notificationsAI/src/main/java/com/rounds/notificationsAI/utils/NotificationScheduler.kt - Notification display
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationDisplayManager.kt
Other components
- App developer
- OpenAI service
- Gemini service
- Hugging Face service
- Ollama server
Connections 23
- App developer → Demo controls: configures
README.md - Demo controls → Notification API: requests generation
app/src/main/java/com/compose/personalizedainotifications/MainActivity.kt - Notification API → Provider options: selects provider
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Notification API → Generation config: builds config
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Notification API → Prompt builder: builds prompt
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Prompt builder → Generation config: reads settings
notificationsAI/src/main/java/com/rounds/notificationsAI/PromptBuilder.kt - Notification API → Client contract: calls client
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Notification API → OpenAI client: dispatches
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Notification API → Gemini client: dispatches
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Notification API → Hugging Face client: dispatches
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Notification API → Ollama client: dispatches
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - OpenAI client → OpenAI service: sends requests
notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt - Gemini client → Gemini service: sends requests
notificationsAI/src/main/java/com/rounds/notificationsAI/api/GeminiClient.kt - Hugging Face client → Hugging Face service: sends requests
notificationsAI/src/main/java/com/rounds/notificationsAI/api/HuggingFaceClient.kt - Ollama client → Ollama server: sends requests
notificationsAI/src/main/java/com/rounds/notificationsAI/api/OllamaClient.kt - Notification API → Generation result: returns outcome
notificationsAI/src/main/java/com/rounds/notificationsAI/NotificationAI.kt - Demo controls → Work scheduler: can schedule
README.md - Boot receiver → Work scheduler: reschedules
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationBootReceiver.kt - Work scheduler → Notification worker: enqueues work
notificationsAI/src/main/java/com/rounds/notificationsAI/background/BackgroundNotificationScheduler.kt - Notification worker → Frequency tracker: checks frequency
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt - Notification worker → Notification API: generates text
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt - Notification worker → Notification display: shows notification
notificationsAI/src/main/java/com/rounds/notificationsAI/background/NotificationWorker.kt - OpenAI client → OpenAI payload models: uses payload types
notificationsAI/src/main/java/com/rounds/notificationsAI/api/OpenAIClient.kt