[英]Android widget works only on emulator not on real device
The widget is working perfectly on emulator 4.1.2, when installed on a real device it doesn't even show on the widget list, just as installed but I cant get it to work properly. 该小部件在模拟器4.1.2上可以正常运行,当安装在真实设备上时,它甚至没有显示在小部件列表中,就像安装时一样,但我无法使其正常工作。
here's the manifest.xml 这是manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.staccato.conectauaem"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme">
<receiver android:name="WgtProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/appwidget" />
</receiver>
<receiver
android:name="WgtReceiver"
android:label="widgetBroadcastReceiver" >
<intent-filter>
<action android:name="com.staccato.intent.action.CONNECT" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/appwidget" />
</receiver>
</application>
</manifest>
and the widget provider 和小部件提供商
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:initialLayout="@layout/main"
android:minHeight="47dp"
android:minResizeHeight="146dp"
android:minResizeWidth="146dp"
android:minWidth="47dp"
android:updatePeriodMillis="1000000" >
</appwidget-provider>
解决了硬重置,安装了小部件,然后重新启动设备,然后将其显示在小部件列表中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.