1

I am trying to make a live wallpaper on Android. I have one class

public class MyWallpaperService extends WallpaperService {
}

And annother class:

public class SettingsActivity extends Activity {
}

I need to make the SettingsActivity communicate with MyWallpaperService in order to set values on the live wallpaper. I have used aidl before and have tried to apply it to this situation. However it seems like WallpaperService has the following method:

/**
 * Implement to return the implementation of the internal accessibility
 * service interface.  Subclasses should not override.
 */
@Override
public final IBinder onBind(Intent intent) {
    return new IWallpaperServiceWrapper(this);
}

Therefore I cannot return my own custom aidl defined binder in the onBind method of my service due to the final declaration on the superclass, WallpaperService's, onBind method. To me this seems like an oversight by the Android platform development team. Does this effectively removes all possible inter process communication abilities from any live wallpaper?

What are my options here? I know I can put the Activity and the Service in the same process and have the Activity set global variables on the Service, but that seems like it could get messy fast and I want to do this right. Is adding a Broadcast Receiver in the Service the right move here?

tshepang
  • 12,111
  • 21
  • 91
  • 136
m3hughes
  • 247
  • 4
  • 15

1 Answers1

0

You could also use BroadCasts to achieve communication between a wallpaper service and some controller activity, source below.

http://developer.samsung.com/android/technical-docs/Effective-communication-between-Service-and-Activity

joe
  • 2,139
  • 2
  • 15
  • 13