appwidget setOnClickPendingIntent not always working

by biokys » Fri, 20 May 2011 18:13:12 GMT


Sponsored Links
 Hi, I have an issue with my appwidget. It has really strange behaviour, 
because when I add widget to desktop it *not always* become clickable, even 
i defined setOnClickPendingIntent. On different phones it has different 
"successfull install ratio".

Thank you for your help

public class BasicWidget extends AppWidgetProvider {


private static final String LOG_TAG = "WalletWidget";

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, 
int[] appWidgetIds) {
Log.d(LOG_TAG, "onUpdate(): ");
context.startService(new Intent(context, UpdateService.class));
 }
 
public static class UpdateService extends Service {
@Override
public void onStart(Intent intent, int startId) {
RemoteViews updateViews = buildUpdate(this);

ComponentName thisWidget = new ComponentName(this, BasicWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);
}

public RemoteViews buildUpdate(Context context) {
RemoteViews updateViews = null;
Intent intent = new Intent(context, RecordActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 
PendingIntent.FLAG_UPDATE_CURRENT);
updateViews = new RemoteViews(context.getPackageName(), 
R.layout.widget_layout);
updateViews.setOnClickPendingIntent(R.id.layout_widget, pendingIntent);

new UpdateWidgetTask(context).execute();

return updateViews;
}

@Override
public void onConfigurationChanged(Configuration newConfig)
{
RemoteViews updateViews = buildUpdate(this);

ComponentName thisWidget = new ComponentName(this, BasicWidget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(this);
manager.updateAppWidget(thisWidget, updateViews);
}

@Override
public IBinder onBind(Intent intent) {
// We don't need to bind to this service
return null;
}
}
 @Override
public void onDeleted(final Context ctx, final int[] aiAppWidgetIds)
{
super.onDeleted(ctx, aiAppWidgetIds);
ctx.stopService(new Intent(ctx, UpdateService.class));
}

-- 



Other Threads

1. How to build full Android for X86 desktop PC - black screen

I'm trying to port Android for Intel X86 desktop PC.
I though it could be possible, because someone already have ported to
ASUS eee701 which is X86 based.

I followed like this.
http://code.google.com/p/patch-hosting-for-android-x86-support/wiki/BuildAndroidForX86Platforms

And applied patch from here.
http://code.google.com/p/patch-hosting-for-android-x86-support/downloads/list

The only different thing I've done is inserting intelfb driver to
kernel image instead of building as a module. And I check it works by
checking /sys/class/graphics/fb0.

Anyway I've booted with new built kernel and rootfs both for eee701.
But during the boot, screen goes black seems to be dead.

I think something wrong on invoking zygote.

And I tested like this.
When I just commented out the zygote invoking part in init.rc shell
command came up.
And following process could be found but mediaserver.
- servicemanager, vold, installd, adbd

Error message below comes up repeatedly.
------------------------------------------------------------------------------
init: event { 'add', '/kernel/uids/1013', 'uids', '', -1, -1 }
init: waitpid returned pid 2003, status = 00007f00
init: process 'media', pid 2003, exited
init: process 'media' killing any children in process group
init: event { 'remove', '/kernel/uids/1013', 'uids', '', -1, -1 }
------------------------------------------------------------------------------

So I think zygote and mediaserver are not working properly.
Please help me out~! >,<

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Theme issues with 1.5

We've got a couple of issues with apps drawing differently in the 1.5
preview SDK.

Theme_Translucent_NoTitleBar_Fullscreen doesn't result in a full
screen, but in one which wraps our content. Also, we get a fat grey
border drawn round our views.

I've not been able to find any way to change these behaviours, which
make me wonder if they might be issues with the SDK. Are there any
known issues along those lines ?

Thanks,

Richard

--~--~---------~--~----~------------~-------~--~----~

3. Bluetooth not working on G1 device (cupcake version)

4. wpa_supplicant wifi problems no scan results

5. after launching audio recording intent "MediaStoreAudio.Media.RECORD_SOUND_ACTION"

6. Do you have an example of layout like contact's form (add) ? (version 1.5)

7. Forecast widget for Android 1.5 (with source!)