必要なときに機能するウィジェットがありますが、そうではありません。具体的には、携帯電話を再起動してウィジェットをタップすると、正常に動作します。おそらくしばらくの間、ウィジェットをタップし続けることができ、すべてが正常に機能します。しかし、最終的には (おそらく 1 時間くらい??) 機能しなくなります。logcat から、私のコードはまったく実行されないため、タップがアプリにディスパッチされないようです。私の思考プロセスは、これが発生したときにコードが実行されないため、問題はマニフェストにあるか、または私が気付いていない何かに違いないということです。
これが機能するときのlogcatです。ここからの最後の行は私のコードから来ています:
07-20 13:00:54.638: E/MP-Decision(1265): UP Ld:85 Nw:1.990000 Tw:140 rq:1.000000 seq:141.000000
07-20 13:00:54.818: I/InputReader(533): Touch event's action is 0x0 (deviceType=0) [pCnt=1, pending(waiting finished signal)=0, s=0.4 ]
07-20 13:00:54.818: I/InputDispatcher(533): Delivering touch to current input target: action: 0x0
07-20 13:00:54.818: D/lights(533): write_int /sys/class/leds/button-backlight/brightness = 255
07-20 13:00:54.818: I/PowerManagerService(533): Ulight 0x3->0x7|0x0
07-20 13:00:54.818: D/PowerManagerService(533): setLightBrightness : mButtonLight : 51
07-20 13:00:54.908: I/InputReader(533): Touch event's action is 0x1 (deviceType=0) [pCnt=1, pending(waiting finished signal)=0, s=]
07-20 13:00:54.908: I/InputDispatcher(533): Delivering touch to current input target: action: 0x1
07-20 13:00:54.918: I/AudioPolicyManagerBase(229): getSituationVolume: isBTConnected:0 isHeadConnected:0
07-20 13:00:54.918: V/AudioPolicyManagerBase(229): getParamFromPolicy deviceInt = 0, situationInt = 1, situationVolume = 0.500000
07-20 13:00:54.918: D/AudioService(533): playSoundEffect()
07-20 13:00:54.918: W/AudioTrack(533): Minimum buffer size corrected from 2048 to 4096
07-20 13:00:54.918: V/AudioPolicyManagerBase(229): startOutput() output 1, stream 1, session 18
07-20 13:00:54.918: V/AudioPolicyManagerBase(229): getDeviceForStrategy() from cache strategy 0, device 2
07-20 13:00:54.918: V/AudioPolicyManagerBase(229): changeRefCount() stream 1, count 1
07-20 13:00:54.918: V/AudioPolicyManagerBase(229): getDeviceForStrategy() from cache strategy 0, device 2
07-20 13:00:54.918: V/AudioPolicyManagerBase(229): getNewDevice() selected device 2
07-20 13:00:54.918: V/AudioPolicyManagerALSA(229): setOutputDevice() output 1 device 2 delayMs 0 force 0
07-20 13:00:54.918: V/AudioPolicyManagerALSA(229): setOutputDevice output :0x1 mCurDevice:0x2
07-20 13:00:54.918: V/AudioPolicyManagerALSA(229): setOutputDevice() setting same device 2 or null device for output 1
07-20 13:00:54.918: D/PHCA_PhcaAppWidgetProvider(2316): onReceive(); action = com.skipmorrow.phca.PhcaAppWidgetProvider.WIDGET_CLICKED
そして、これが機能しなかったときのログキャットです。
07-20 12:53:41.012: I/InputReader(534): Touch event's action is 0x0 (deviceType=0) [pCnt=1, pending(waiting finished signal)=0, s=0.160 ]
07-20 12:53:41.012: I/InputDispatcher(534): Delivering touch to current input target: action: 0x0
07-20 12:53:41.012: D/lights(534): write_int /sys/class/leds/button-backlight/brightness = 255
07-20 12:53:41.012: I/PowerManagerService(534): Ulight 0x3->0x7|0x0
07-20 12:53:41.012: D/PowerManagerService(534): setLightBrightness : mButtonLight : 51
07-20 12:53:41.112: I/InputReader(534): Touch event's action is 0x1 (deviceType=0) [pCnt=1, pending(waiting finished signal)=0, s=]
07-20 12:53:41.112: I/InputDispatcher(534): Delivering touch to current input target: action: 0x1
07-20 12:53:41.112: I/AudioPolicyManagerBase(230): getSituationVolume: isBTConnected:0 isHeadConnected:0
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): getParamFromPolicy deviceInt = 0, situationInt = 1, situationVolume = 0.500000
07-20 12:53:41.112: D/AudioService(534): playSoundEffect()
07-20 12:53:41.112: W/AudioTrack(534): Minimum buffer size corrected from 2048 to 4096
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): startOutput() output 1, stream 1, session 153
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): getDeviceForStrategy() from cache strategy 0, device 2
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): changeRefCount() stream 1, count 1
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): getDeviceForStrategy() from cache strategy 0, device 2
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): getNewDevice() selected device 2
07-20 12:53:41.112: V/AudioPolicyManagerALSA(230): setOutputDevice() output 1 device 2 delayMs 0 force 0
07-20 12:53:41.112: V/AudioPolicyManagerALSA(230): setOutputDevice output :0x1 mCurDevice:0x2
07-20 12:53:41.112: V/AudioPolicyManagerALSA(230): setOutputDevice() setting same device 2 or null device for output 1
07-20 12:53:41.112: V/AudioPolicyManagerBase(230): releaseOutput() 1
問題として際立っているものは何も見当たりません。
widgetProvider のマニフェスト セクションは次のとおりです。
<receiver android:name="com.skipmorrow.phca.PhcaAppWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="com.skipmorrow.phca.PhcaAppWidgetProvider.WIDGET_CLICKED" />
<action android:name="com.skipmorrow.phca.PhcaAppWidgetProvider.VARIABLE_UPDATED" />
<action android:name="android.appwidget.action.APPWIDGET_DELETED"/>
<action android:name="CORRECT_PIN_ENTERED_FOR_WIDGET"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/phca_widget_info" />
</receiver>
ところで、私はICSを実行しているSamsung Galaxy S3を使用しています。私のアプリには minSdkVersion="8" と targetSdkVersion="8" があります
週末にかけて回答はありませんでしたが、トラブルシューティングを行いました。まだ問題がありますが、追加情報があります。
ウィジェットは、ウィジェットにテキストを提供するバックグラウンド サービスから更新されます。しかし、ウィジェットは、クリックされたときに常に想定どおりに動作するとは限りません。つまり、クリックが正しく処理されない場合でも、ウィジェット内のテキストを更新できるので、ウィジェットが完全に壊れているわけではありません。また、クリック応答が行ったり来たりしているようです。つまり、再起動後、クリックはしばらく機能しているように見えますが、しばらく機能しなくなってから、再び機能し始めます。私の AppWidgetProvider は onUpdate、onEnabled、onDeleted、onDisabled、および onReceive メソッドをオーバーライドしますが、onReceive メソッドのみを使用し、各インテントを手動で追跡します。onReceive メソッドの最初の行がログに書き込まれるので、クリックが機能していないときに、
パーミッションの問題でしょうか?または、受信者を正しく登録していませんか?