I honestly have no idea what I'm doing wrong here. I had this working last night, I messed with the code and I'm pretty sure I have it back to where it was yet it simply doesn't do anything when clicked.
Here is my code
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
Log.d(LOG_TAG, "onUpdate(): ");
for (int appWidgetId : appWidgetIds) {
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("market://details?id=com.xx.xx"));
PendingIntent pendingIntent = PendingIntent.getActivity(context, appWidgetId, intent, PendingIntent.FLAG_UPDATE_CURRENT );
RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widget);
remoteView.setOnClickPendingIntent(R.id.image, pendingIntent);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
I'm simply trying to take the user to the market when the widget is clicked but nothing at all happens.
Is this a simple fix?
OH MY GOD. I've spent about 4-5 hours on this.. just realized what I've done wrong.
I was missing 'appWidgetManager.updateAppWidget(appWidgetId, remoteView);' after my setOnClickPendingIntent.
The joys of programming.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With