Add fallbacks when the Sugar API is not available

This makes the html activities runnable again as standalone apps,
outside Sugar.