Proper way to start and stop DayDream service from activity
<p>I am developing an application which should display a daydream in special circumstances, 
I searched everywhere to find a proper way to start my daydream service through my MainActivity class with no luck,</p>

<p>Currently i am using following code to start daydream and actually it works, but i need a better solution which provides me a way to stop the daydream.</p>

<pre><code> public void startDayDream(){
    final Intent intent = new Intent(Intent.ACTION_MAIN);
    try {
        // Somnabulator is undocumented--may be removed in a future version...
        intent.setClassName("com.android.systemui",
                "com.android.systemui.Somnambulator");
        intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        startActivity(intent);
    } catch (Exception e) { /* Do nothing */ }
}
</code></pre>