When I change the namespace of my widget provider, the widget goes blank and doesn't work until I delete it and add it again.
How would one change the namespace and the receiver name for a widget without breaking already placed widgets.
Before rename:
<receiver android:name="com.creativitality.labs.timezoneswidget.WidgetProvider" android:label="#string/widget" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_info_large" />
</receiver>
After moving and renaming provider:
<receiver android:name="com.creativitality.labs.timezoneswidget.widget.WidgetLarge" android:label="#string/widget_4x1" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_info_large" />
</receiver>
For activities, you can create an <activity-alias> element in your manifest that points to the new name of the <activity>.
There is no solution for receivers. <receiver-alias> does not exist. Your receiver must keep its original name forever or it will break.
Related
I am trying to make an existing android app wearable.
Is it necessary, or not, to specify the full package path for setting a media button event receiver?
I haven't seen any explanation in the official documentation. It is as follows in the documentation:
<receiver android:name=".RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
While I have this in my current code:
<receiver android:name="com.pckg.my.app.subpack.RemoteControlReceiver">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
Try to add (.) in the beginning of your android name
<receiver android:name=".com.pckg.my.app.subpack.RemoteControlReceiver">
I have an AppWidget in my app, but I cannot get it to change its icon in the widget drawer.
I set the icon in AndroidManifest
<receiver android:name=".MealWidget"
android:label="AwesomeWidget"
android:icon="#drawable/ic_meals_icon">
And set the PreviewImage in the appwidget-provider:
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:previewImage="#drawable/ic_meals_icon" />
But the icon is still the default blue rectangle with "EXAMPLE" written on it. What am I missing?
According to the document this is the way of declaring a widget reciever in manifets.
<receiver android:name="ExampleAppWidgetProvider" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/example_appwidget_info" />
</receiver>
For more info, refer this link
http://developer.android.com/guide/topics/appwidgets/index.html
My widget won't install. I'm trying to install a home screen widget using android. I've put the widgetprovider in the manifest along with a configuration class. It just doesn't show up in the list of widgets and I hence can't install it! Console gives no errors.
The update widget receiver is there in the manifest. But the widget isn't even created so what's the point? The widget won't get created!
I've created the layout, created the widget information file and filled in the fields, registered it in the manifest, created the classes, it still won't work.
<receiver
android:name=".WidgetProvider"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.appwidget.action.WIDGET_PROVIDE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="#xml/widget_info"/>
</receiver>
<activity
android:name=".WidgetConfig"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.appwidget.action.WIDGET_CONFIG" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
There is an error in your manifest. The intent filter should contain
action android:name="android.appwidget.action.APPWIDGET_UPDATE"
not:
action android:name="android.appwidget.action.WIDGET_PROVIDE"
If you have more than one widget provider, each one needs its own receiver containing this action. Here is an example for one widget provider:
<receiver android:name=".WidgetProvider"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="#layout/widget_provider_2x1"/>
</receiver>
So, I trying to implement synchronization based on SyncAdapter of my content provider and server. Seems everything created and initializated well and I can see my account in Accounts&Sync and also see checkbox for sync my content provider.
But I got strange error in LogCat:
ERROR/AccountSettings(130): Provider needs a label for authority 'com.opussync.model.db.opuscontentprovider'
But I has set that label in manifest for sure!
And that's why I think when I try to check sync checkbox in Data&Synchronization of my account I get a message:
Sync is currently experiencing problems. It will be back shortly
Here is main parts of my manifest:
<!-- CONTENT PROVIDER -->
<provider
android:name=".model.db.OpusContentProvider"
android:label="BLABLABLA"
android:authorities=".model.db.opuscontentprovider"
></provider>
<!-- SERVICES -->
<service android:name=".service.OpusAccountsSyncService" android:exported="true" android:process=":zencoosync">
<intent-filter >
<action android:name = "android.accounts.AccountAuthenticator"/>
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="#xml/authenticator" />
</service>
<service
android:name=".model.syncadapter.SyncService"
android:exported="true"
android:syncable="true"
>
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="#xml/syncadapter" />
</service>
Package name is not automatically added to android:authorities.
So, either
change android:authorities=".model.db.opuscontentprovider" to android:authorities="com.opussync.model.db.opuscontentprovider" or
use content://.model.db.opuscontentprovider as the base URL for content provider in code.
I am trying to solve a start on boot related problem and I noticed many examples of the AndroidManifest.xml which has android.intent.action.BOOT_COMPLETED and some that also have the category of android.intent.category.HOME in there. Does anyone know what the difference (if any) between the two are?
ie.
<receiver android:name=".MartiniBootBroadCastReciever"
android:enabled="true" android:exported="false"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
versus
<receiver android:name=".MartiniBootBroadCastReciever"
android:enabled="true" android:exported="false"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
AFAIK, your first one is wrong. The BOOT_COMPLETED broadcast should not have that category, AFAIK.