Get code to compile for API level 11

* setForeground has been removed since API 11, hence do for it the same workaround that you've done for {start,stop}Foreground
* Add override for Cursor#getType method