I am able to start Activity class on click of wid开发者_如何学Goget button, but when try same for start service it's not working, let me know how can i call start service here.
thanks
Use this line of code
startService(new Intent(this, YOUR_SERVICE_CLASS_NAME.class));
Try this code man
Intent i = new Intent(this, MyWidget.class);
PendingIntent pi = PendingIntent.getBroadcast(context,0, i,0);
RemoteViews updateView = new RemoteViews(context.getPackageName(),R.layout.n);
updateViews.setOnClickPendingIntent(R.id.update_button,pi);
精彩评论