Android design advice - services & broadcast receivers

Posted by basudz on Programmers See other posts from Programmers or by basudz
Published on 2013-04-09T14:55:50Z Indexed on 2014/05/29 9:42 UTC
Read the original article Hit count: 173

I'm in the process of learning the Android SDK and creating some projects to get a grasp on the system. The current project I'm working with works just fine but I'd like to get some advice about other ways I can go about designing it.

Here's what it needs to do. When a text message is received from a specific number, it should fire off a toast message that repeats at a certain interval for a specific duration.

  1. To make this work, I created an SMS BroadcastReceiver and checked the incoming messages for the number I'm looking for.

  2. If found, an IntentService would be started that would pull out the interval and duration from saved shared prefs. The IntentService would then fire off a broadcast.

  3. The BroadcastReceiver for this would catch it and use the AlarmManager to handle the toast message repetitions.

This all works just fine, but I'm wondering if there's a cleaner or more efficient way of going about doing this? Any suggestions or advice?

© Programmers or respective owner

Related posts about design-patterns

Related posts about android