0
在我的應用程序中,我發送了更新appWidget的意圖。問題是,從logcat我可以看到,意圖平均需要十秒才能收到。Android意圖需要很長時間才能收到
05-16 18:12:54.070: DEBUG/PHCA_Variable(7580): Broadcast sent
05-16 18:12:54.080: INFO/ActivityManager(274): Starting: Intent { flg=0x10000000 cmp=com.skipmorrow.phca/.WidgetDialogResponseActivity (has extras) } from pid 7580
05-16 18:12:54.100: WARN/ActivityManager(274): Trying to launch com.skipmorrow.phca/.WidgetDialogResponseActivity
05-16 18:12:54.170: DEBUG/InputTransport(274): Input channel constructed: name='40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (server)', ashmemFd=299, receivePipeFd=311, sendPipeFd=310
05-16 18:12:54.170: DEBUG/InputTransport(274): Input channel constructed: name='40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (client)', ashmemFd=304, receivePipeFd=309, sendPipeFd=313
05-16 18:12:54.170: DEBUG/InputTransport(274): Input channel destroyed: name='40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (client)', ashmemFd=304, receivePipeFd=309, sendPipeFd=313
05-16 18:12:54.180: DEBUG/InputTransport(7580): Input channel constructed: name='40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (client)', ashmemFd=66, receivePipeFd=67, sendPipeFd=68
05-16 18:12:54.460: INFO/ActivityManager(274): Displayed com.skipmorrow.phca/.WidgetDialogResponseActivity: +362ms
05-16 18:12:56.140: INFO/InputDispatcher(274): Delivering key to current input target: action: 0, channel '40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (server)'
05-16 18:12:56.260: INFO/InputDispatcher(274): Delivering key to current input target: action: 1, channel '40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (server)'
05-16 18:12:56.390: DEBUG/InputTransport(7580): Input channel destroyed: name='40832a98 com.skipmorrow.phca/com.skipmorrow.phca.WidgetDialogResponseActivity (client)', ashmemFd=66, receivePipeFd=67, sendPipeFd=68
05-16 18:13:03.350: DEBUG/PHCA_PhcaAppWidgetProvider(7580): onReceive(); action = android.appwidget.action.APPWIDGET_UPDATE
我看到的唯一看起來有點腥的是一個警告,一個活動開始。爲什麼會是一個警告?除此之外,一切似乎都沒問題。
代碼發送意圖沒什麼特別的:
Log.d(MY_DEBUG_TAG, "UpdateAppWidgets()");
Intent i = new Intent();
i.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
ComponentName phcaWidget = new ComponentName(ctx, PhcaAppWidgetProvider.class);
i.putExtra("appWidgetIds", AppWidgetManager.getInstance(ctx).getAppWidgetIds(phcaWidget));
ctx.sendBroadcast(i);
Log.d(MY_DEBUG_TAG, "Broadcast sent");
而且在的onReceive的的AppWidgetProvider是沒有什麼特別的要麼。 Log語句是第一個命令。
什麼可能導致意圖花費十秒鐘以上才能收到?
跳過
我試着在沒有連接到eclipse的情況下運行應用程序,並得到了相同的結果。我沒有將意圖發送到活動。相反,我將意圖發送給AppWidgetProvider以更新appWidget。至於調試模式,是否有一種方法可以禁用應用程序的調試模式,或者您是否在談論手機的USB調試功能? – MrGibbage
我在談論從eclipse啓動應用程序,使用「debug as」或「run as」,沒有比這更深的。如果在手機上運行得很慢,我沒有很好的建議。 – mwengler