I am trying to dd my application the "Accounts Section" of the settings. So that when the user clicks on Add account , my app name is visible. The complete code can be found here
I have created an authenticator service. This is how my manifest looks like
<service android:name=".AuthenticatorService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="#xml/authenticator" />
</service>
I also created an "authenticator.xml"
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.udinic.auth_example"
android:icon="#drawable/ic_launcher"
android:smallIcon="#drawable/ic_launcher"
android:label="testing"
android:accountPreferences="#xml/prefs"/>
But still I dont see my app under accounts. I am following this tutorial
but its not working. Can you tell me what am I doing wrong ?
Use a resource string instead of using literal text in label.
"authenticator.xml"
android:label="#string/some_label"
Related
I have the app running the way I want, but want to be able to set the app as a live wallpaper.
Editing AndroidManifest.xml, I am able to see the app in the wallpaper chooser, but selecting it causes the app to crash (probably due to lack of a "preview".
<!-- Live Wallpaper service -->
<service
android:name="MyWallpaperService"
android:enabled="true"
android:label="HDLW"
android:permission="android.permission.BIND_WALLPAPER" >
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" ></action>
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/livewallpaper" >
</meta-data>
</service>
The livewallpaper.xml contains the following
<?xml version="1.0" encoding="UTF-8"?>
<wallpaper
xmlns:android="http://schemas.android.com/apk/res/android"
android:thumbnail="#drawable/icon"
android:settingsActivity="com.tns.NativeScriptActivity"
/>
com.tns.NativeScriptActivity seems to be what runs main.js, and setting android:settingsActivity to it allows the settings icon to actually load the app and show it.
So my questions are:
1) How to I make com.tns.NativeScriptActivity also run in the wallpaper preview? and
2) How do I actually set the com.tns.NativeScriptActivity as the wallpaper?
I have created a custom account_type (com.axonsystem.kangoosave) and is working fine. Also when I create contacts under this account_type programatically, in the Contacts Application (when I edit the contact) Android shows correctly my custom type.
This is my sync-adapter
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:accountType="com.axonsystem.kangoosave"
android:userVisible="true"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true"
android:supportsUploading="false" />
And my service providing the SyncAdapter
<service
android:name="com.axonsystem.kangoosave.services.AccountSyncService"
android:exported="true"
android:enabled="true"
android:process=":sync">
<intent-filter>
<action android:name="android.content.SyncAdapter"/>
</intent-filter>
<meta-data android:name="android.content.SyncAdapter"
android:resource="#xml/syncadapter"/>
<meta-data android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="#xml/contacts" />
</service>
My account-authenticator
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.axonsystem.kangoosave"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:smallIcon="#drawable/ic_launcher"
android:accountPreferences="#xml/account_preferences"/>
Now I want that my custom-type appears in Contacts Activity when creating a new contact (like google accounts and so on), even in the menu of "Contacts to display". Is it poosible ? Do someone have some information about that? I'm not able to get success in this point..
Thank you in advance
My first guess is that you'll have to change android:supportsUploading="false" in your sync-adapter xml to android:supportsUploading="true", otherwise the account may be considered being read-only (that's how it was handled in Android 2.x and I think that might be still the case).
Also it's important that your xml/contacts file defines a non-empty contacts schema, check out test_basic_contacts.xml for a complete example. An empty EditSchema basically means that no fields can be edited, which means the account is read-only as well (hence you can't create contacts).
I'm trying to add my app to the global search in Android so users can search my app from their homescreen. I've followed the tutorial at http://developer.android.com/guide/topics/search/search-dialog.html but it won't seem to work. When I test the app and go to the part of the settings where you see all the searchable apps my app doesn't show up. Here's some of my code:
The Mainfest:
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
This of course is within the tag.
searchable.xml (res/xml/searchable.xml):
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:includeInGlobalSearch="true"
android:voiceSearchMode="showVoiceSearchButton"
android:label="Holo Wikipedia Search"
android:hint="Search Wikipedia" >
</searchable>
Please leave a commment if there's any more you want to see :)
Did you try using string resources for the label and hint?
Instead of hard-coded strings, try something like this:
android:label="#string/label_string"
android:hint="#string/hint_string"
I have two widgets and neither of them will show up in the app drawer. What's weird is that if I remove one from the manifest it won't show up either but I can't see what I am doing wrong. From all the other questions I searched it looks right. The app is not being installed on the SD card.
Anyone have any ideas?
AndroidManifest.xml
<receiver
android:name=".appwidgets.WidgetLarge"
android:label="#string/Widget_large"
android:icon="#drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.groggs.action.CACHE_UPDATE_FINISHED" />
</intent-filter>
<intent-filter>
<action android:name="WIDGET_UPDATE" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_large_info" />
</receiver>
<receiver
android:name=".appwidgets.WidgetSmall"
android:label="#string/Widget_small"
android:icon="#drawable/icon" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<intent-filter>
<action android:name="com.groggs.action.CACHE_UPDATE_FINISHED" />
</intent-filter>
<intent-filter>
<action android:name="WIDGET_UPDATE" />
<data android:scheme="content" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/widget_small_info" />
</receiver>
widget_large_info.xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:maxWidth="450dp"
android:maxHeight="352dp"
android:updatePeriodMillis="0"
android:initialLayout="#layout/widget_layout_large"
android:configure="com.groggs.appwidgets.config.HubQuickViewWidgetConfig" >
</appwidget-provider>
widget_small_info.xml
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:maxWidth="450dp"
android:maxHeight="82dp"
android:updatePeriodMillis="0"
android:initialLayout="#layout/widget_layout_small"
android:configure="com.groggs.appwidgets.config.HubQuickViewWidgetConfig" >
</appwidget-provider>
Add "minHeight" and "minWidth" attributes to your appwidget-provider elements for each of your appwidgets and see if this does the trick for you.
If you check logcat when running it in the emulator, you should notice the launcher outputting a message about invalid dimensions and the name of your widget will be attached to this line.
I just had this issue and this is how I solved it (although I had one min and on max provided on accident). The logcat message said I had a dimension of (108, 0). This lead me into looking at all my dimensions since it was yelling at me for height being 0.
This was my post:
App Widget not displaying in ICS app drawer
If your app is only an appwidget, with no activities besides a configuration one, you need a dummy main activity to make your appwidget appear in the drawer.
See the original issue in Google Code: http://code.google.com/p/android/issues/detail?id=24208, this answer: Android 4.0: widgets not appearing? and also this interesting thread in Android Devs Google Group: https://groups.google.com/forum/?fromgroups#!topic/android-developers/bvlk3EOV6Xk (it's about Honeycomb, but applies to Android versions 3.x and greater)
We implemented Android's Account Manager and Sync Manager api to create contact sync. But when user selects our account while adding contact, it only displays Name fields and all other fields disappear.
Here is what I have in my manifest
<activity android:name=".AuthenticatorActivity" android:label="iAnywhere Login"
android:theme="#android:style/Theme.Dialog"
android:excludeFromRecents="true"></activity>
<service android:name=".accounts.AuthenticationService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator"></action>
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator"
android:resource="#xml/authenticator">
</meta-data>
</service>
<service
android:name=".accounts.SyncService"
android:exported="true">
<intent-filter>
<action
android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data
android:name="android.content.SyncAdapter"
android:resource="#xml/syncadapter" />
</service>
This is what I have in my syncadapter.xml and authenticator.xml
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="com.android.contacts"
android:accountType="com.rahul.utility.contacts"
/>
Have seen people talk about this kind of issue while adding custom fields that it is a bug in Contact application. I also checked out the code of Exchange Email client in Android source code and they seems to be doing exactly same as what I did, but still when you select Add Contact for an Exchange account it shows up all the fields in the contact.
After a lot of research and looking into the Android code base I found that Android only checks the account type to be either of Google or Default for rendering all the fields. If the account type is of any other type, it only displays basic two fields. There are no work around to it apart from creating your own Contact Add / Edit screen (Sad! Really).
There was a possibility where Android could have provided an interface for others to return field types which they wanted on the screen but it is not implemented that way as of now.