Android Widget won't start a Service
<p>I need to make a widget which, once clicked, would start a service. Service would perform a certain action, change the widgets picture, play a sound, etc., and stop.</p>

<p>AppWidgetProvider:</p>

<pre><code>public class WidgetActivity extends AppWidgetProvider {


 @Override
 public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {

        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
        Intent intent = new Intent(context.getApplicationContext(), SilentService.class);
        intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
        PendingIntent pendingIntent = PendingIntent.getService(
                context.getApplicationContext(), 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);
        remoteViews.setOnClickPendingIntent(R.id.LinLayWiget, pendingIntent);
        appWidgetManager.updateAppWidget(appWidgetIds, remoteViews);

        context.startService(intent);

 }


}
</code></pre>

<p>service:</p>

<pre><code>public class SilentService extends Service {
    @Override
    public IBinder onBind(Intent intent) {
    return null;
    }
    @Override
    public void onCreate() {

        Toast.makeText(this, "I'm Alive!", 1500).show();
        MediaPlayer mpl = MediaPlayer.create(this, R.raw.enter );
        mpl.start();

    }



    @Override
    public void onDestroy() {
    //code to execute when the service is shutting down
    }
    @Override
    public void onStart(Intent intent, int startid) {
    //code to execute when the service is starting up
    }



    }
</code></pre>

<p>manifest:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="FX.Widget"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;uses-sdk android:minSdkVersion="8" /&gt;

    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;

        &lt;receiver android:name="widget.cam.com.WidgetActivity" android:label="FXMaster" android:icon="@drawable/assiconwi"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.appwidget.action.APPWIDGET_UPDATE" /&gt;
                &lt;action android:name="android.appwidget.action.APPWIDGET_ENABLED"/&gt; 
            &lt;/intent-filter&gt;
            &lt;meta-data 
                android:name="android.appwidget.provider"
                android:resource="@xml/widgetprovider" /&gt;
        &lt;/receiver&gt;


        &lt;service
        android:enabled="true"
        android:name=".SilentService"&gt;
        &lt;/service&gt;


    &lt;/application&gt;
&lt;/manifest&gt;
</code></pre>

<p>But once I click on the widget, nothing happens... any ideas why?</p>

<p>Thanks!</p>
