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. Will TCP Sockets work over cellular network?

Hi All,

I'm writing a small game for Android and was planning on using the
Socket class to establish a connection to my server from the Client. I
had been testing on the emulator only as I don't have an Android phone
yet. A friend mentioned today that TCP socket connections may not be
allowed over a cellular network at the network's discretion, is this
true?

I can try to use Http and long polling but sockets seem so much
simpler, if anyone knows a good code sample or concerning the use of
long polling for two way communication in games then please let me
know.

Kind regards,

Gavin

-- 

2. Eclair's opencore does not compile

Hi
With ECLAIR's source code, trying to compile opencore module
separatley I get some missing included files as well as some  missing
"-I" options in the build system.
Can anybody point me at the right/quickest fixes for this?


Here's the list of really missing files during the build:
=======================================
tools_v2/build/make/entry_point.mk:142: build_config/opencore_dynamic/
build/installed_include/ALL_HDRS_INSTALLED: No such file or directory
tools_v2/build/make/entry_point.mk:143: build_config/opencore_dynamic/
build/installed_lib/linux/ALL_LIBS_INSTALLED: No such file or
directory
nodes/pvomxencnode/src/pvmf_omx_enc_node.cpp:55:23: error: utils/
Log.h: No such file or directory
nodes/pvomxvideodecnode/src/pvmf_omx_videodec_node.cpp:36:23: error:
utils/Log.h: No such file or directory
nodes/pvomxaudiodecnode/src/pvmf_omx_audiodec_node.cpp:37:23: error:
utils/Log.h: No such file or directory
codecs_v2/omx/omx_m4v/src/mpeg4_dec.cpp:31:23: error: utils/Log.h: No
such file or directory

The following files are there but their path does not show up as a "-
I" option:
==============================================================================
build_config/opencore_dynamic/build/installed_include/
pvmf_omx_basedec_node.h:85:22: error: OMX_Core.h: No such file or
directory
build_config/opencore_dynamic/build/installed_include/
pvmf_omx_basedec_node.h:89:27: error: OMX_Component.h: No such file or
directory
build_config/opencore_dynamic/build/installed_include/
pvmf_omx_basedec_callbacks.h:30:23: error: OMX_Types.h: No such file
or directory

As a consequence of the above here are the symbols the compiler fails
to recognise:
==================================================================================
 'ANDROID_PRIORITY_AUDIO' was not declared in this scope
 'LOGE' was not declared in this scope
 'LOGW' was not declared in this scope
 'OMX_BOOL' does not name a type
 'OMX_CALLBACKTYPE' does not name a type
 'OMX_ERRORTYPE' does not name a type
 'OMX_EVENTTYPE' does not name a type
 'OMX_EXTRADATATYPE' has not been declared
 'OMX_HANDLETYPE' does not name a type
 'OMX_PARAM_PORTDEFINITIONTYPE' does not name a type
 'OMX_PTR' does not name a type
 'OMX_PTR' has not been declared
 'OMX_STATETYPE' does not name a type
 'OMX_TICKS' does not name a type
 'OMX_U32' does not name a type
 'OMX_U32' has not been declared
 'PRIO_PROCESS' was not declared in this scope
 'PVLOGMSG_STACK_ERR' was not declared in this scope
 'gettimeofday' was not declared in this scope
 'setpriority' was not declared in this scope
 ISO C++ forbids declaration of 'OMX_BUFFERHEADERTYPE' with no type
 ISO C++ forbids declaration of 'OMX_TICKS' with no type
 class 'InputBufCtrlStruct' does not have any field named 'pBufHdr'



This is happening only in ECLAIR's code. The master branch compiles
cleanly.
Thank you for any help.
--
iod

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

3. opencore test cases issue

4. Engadget article asking whether android fragmentation will destory the platform

5. mau root tp bingung

6. New Android SDK Tools, Eclipse plug-in and NDK

7. Android Setup (SWT folder '' does not exist)