Android contacts - custom field icon not showing in android 6 - android

The goal
I'm working on application that keeps own contacts in contacts database. I want to add my own field with my logo that leads to my application's edit form.
What I did already
Working with this tutorial: http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/
and a couple of other sources i have assembled something like this:
AndroidMainifest.xml:
<service android:enabled="true" android:exported="true" android:name="com.MySyncAdapterService" android:process=":contacts">
<intent-filter android:icon="#drawable/icon">
<action android:name="android.content.SyncAdapter" />
</intent-filter>
<meta-data android:name="android.provider.CONTACTS_STRUCTURE" android:resource="#xml/contacts" />
<meta-data android:name="android.content.SyncAdapter" android:resource="#xml/sync_contacts" />
</service>
Contacts.xml:
<ContactsAccountType xmlns:android="http://schemas.android.com/apk/res/android">
<ContactsDataKind
android:icon="#drawable/icon"
android:smallIcon="#drawable/icon"
android:mimeType="vnd.android.cursor.item/vnd.my.contact"
android:summaryColumn="data2"
android:detailColumn="data3"
android:detailSocialSummary="true" >
</ContactsDataKind>
</ContactsAccountType>
The problem
As can be seen on first image my custom field is displayed with icon properly in Android 4.3. Unfortunatetly Android 6.0.1 does display my field but without the icon.
Any help will be appreciated, I'm running out of hair on my head ;)

I think i resolved my problem. Android 6.0 seems to ignore ContactsDataKind icon property. In order to provide icon for custom field you need to provide action hadndling it. It will use intent filter's icon if it's provided. If not it will use your application's icon.
<activity android:name=".ContactActivity">
<intent-filter android:icon="#drawable/icon">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/vnd.my.contact" />
</intent-filter>
</activity>

Related

In my Flutter project, adding a Browsable category in AndroidManifest.xml makes my app unusable

Recently, I've added the stripe_sdk package to my flutter project. The 3DS system requires to add a deep link mechanism to come back to the app when the 3D is OK or KO.
On iOS, I modified my Info.plist to declare the scheme, it works well when I debug and when I deploy the released version via diawi.
On Android, I modified my android/app/src/main/AndroidManifest.xml to add in intent-filters :
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="myapp"
android:host="3ds.myapp.fr" />
</intent-filter>
No compilation issue, when I debug on simulator or device, no problem.
The issue appears when I build a release package using flutter build apk, and distribute it via diawi. the apk is well download, installation works also, but at the end of the installation, The "Open" button is not active. The app is not present with others apps.
If I go to parameters -> Applications, I can find my app, but the "open" button is also inactive. I can only uninstall my app.
PS : The issue is exactly the same if I upload directly my apk without using diawi.
I tried to modify the scheme and host, and the result is always the same : unable to open my app.
If I modify my AndroidManifest.xml to remove the BROWSABLE category and rebuild the package, all becomes OK again. The app can be launched.
What can be the issue ?
Thanks,
Luc
My full AndroidManifest.xml :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.myapp">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="myapp"
android:icon="#mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="#style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="myapp"
android:host="3ds.myapp.fr" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
The standard launcher intent in Android does not include a URI, so it will not match the combined filter.
An intent that contains neither a URI nor a MIME type passes the test only if the filter does not specify any URIs or MIME types.
In order to accept both the launcher intent and an ACTION_VIEW intent for your URI scheme, MainActivity will need two intent filters:
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="myapp"
android:host="3ds.myapp.fr" />
</intent-filter>

Using Multiple Input_Method_Service in an App

I have used InputMethodService in my ImageKeyboard app to send Images from keyboard.
I have repeated the same thing with my second app : EmojiKeyboard app to send Emojis from keyboard.
Now, I have to combine both the app with single one. So, I found in manifest as below :
in my EMOJIKEYBOARD app :
<service
android:name=".EmojiKeyboardService"
android:label="#string/app_name"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data
android:name="android.view.im"
android:resource="#xml/method" />
</service>
The another one is in my IMAGEKEYBOARD app :
<service
android:name=".service.ImageKeyboard"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
</intent-filter>
<meta-data
android:name="android.view.im"
android:resource="#xml/method" />
</service>
Now, here #xml/method for first app is like :
<input-method xmlns:android="http://schemas.android.com/apk/res/android" />
and for second is like :
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:isDefault="false"
android:settingsActivity="com.myapp.MySettings"></input-method>
Here, it gives me :
Now, I have confused that, How can I switch between this two ?
Any idea ? Because, I have to open two different layouts for keyboard i.e. switching between two services.
Hope for the best solution.Thanks.

App icon not visible when code is run

I have created an android app using android studio. When i run my code on the IDE, its runs as expected on the connected phone. The problem is, it does not leave behind an icon on my phone to use it next time. I will again have to run from android studio to use the app. This was fine initially, i don't realize what made the icon vanish. The app is also present in the settings.
When i go to
Settings->apps
i can very well find my app over there. It is not disabled. I tried uninstalling the app and trying again. It still doesn't give me the icon.
I cleared defaults, forced closed and tried everything possible. Nothing is helping me.
Please help.
My AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".TwitterLogin"
android:label="#string/title_activity_twitter_login" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".NextActivity"
android:label="#string/title_activity_next" >
</activity>
<meta-data
android:name="io.fabric.ApiKey"
android:value="b1fe9f0c7d80c3c24879d634b199f2d0e474b4ba" />
<activity
android:name=".WebViewActivity"
android:label="#string/title_activity_web_view" >
</activity>
</application>
</manifest>
You should specify a different for every intent that can launch your app. So one for the BROWSER category with your url data, and one for the LAUNCHER category.
From the App Manifest Guide.
Components advertise their capabilities — the kinds of intents they can respond to — through intent filters. Since the Android system must learn which intents a component can handle before it launches the component, intent filters are specified in the manifest as elements. A component may have any number of filters, each one describing a different capability.
Your code would become something like:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.chillumapp.com"
android:pathPrefix="/chillum"
android:scheme="http" />
</intent-filter>

Global search not working as expected in Android 4.4

I've got an application that has two search suggestion providers that both extend SearchRecentSuggestionsProvider, and I've set it up correctly in the manifest file with the following Intent filter and meta-data:
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable_tv" />
The searcable resource includes android:includeInGlobalSearch="true", so that should be fine.
And I've obviously got a provider there as well:
<provider
android:name="com.miz.contentprovider.TvShowContentProvider"
android:authorities="com.miz.contentprovider.TvShowContentProvider"
android:exported="true" />
This all worked just fine in Android 4.3 using the Google search application, but I've just updated all my devices to Android 4.4 and I am no longer able to search content within my application. Same thing goes for other applications that worked before the OS update, i.e. Google Play Music.
I've found a thread on XDA developers that mentions this as well, if it helps: http://forum.xda-developers.com/showthread.php?p=47472102
Does anyone have any idea what's happening or how it can be fixed?
Update: I can confirm that it only occurs on devices with Android 4.4. I've tested on an Android 4.3 device using the latest Google Search update, and it works as expected. Looks like it's a bug in Google's update.
I found this commit in AOSP, which might be related:
https://android.googlesource.com/platform/packages/apps/QuickSearchBox/+/ecf356c15143ab0583c64682de16d94a57f7dd1c
The commit message tells us that this feature was removed due to performance reasons (which might or might not be true, given that it references an internal ticket id and I didn't find a related issue about this on the official bugtracker).
I checked with contacts at Google, and App Indexing is replacing this. The documentation will be updated to show this as deprecated, and there is no way to get this feature to work on Kit Kat without system level permissions (as iDev showed above).
Google Chrome appears now as a searchable app since its last update (v31).
System Application:
Have try like this
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.globalsearch" android:sharedUserId="android.uid.shared">
<uses-permission android:name="android.permission.GLOBAL_SEARCH" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS" />
<application android:label="#string/global_search" android:process="android.process.acore">
<activity android:name=".GlobalSearch" android:permission="android.permission.GLOBAL_SEARCH_CONTROL" android:stateNotNeeded="true" android:theme="#android:style/Theme.NoDisplay" android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<!-- This must be higher than the default priority (0), which
is what GoogleSearch uses. -->
<intent-filter android:priority="500">
<action android:name="android.search.action.GLOBAL_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable" android:resource="#xml/searchable" />
</activity>
<activity android:name=".SearchSettings" android:label="#string/search_settings">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<action android:name="android.search.action.SEARCH_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<provider android:name=".SuggestionProvider" android:authorities="com.android.globalsearch.SuggestionProvider" android:permission="android.permission.GLOBAL_SEARCH_CONTROL" />
<provider android:name=".StatsProvider" android:authorities="com.android.globalsearch.stats" android:permission="android.permission.GLOBAL_SEARCH_CONTROL" />
<meta-data android:name="android.app.default_searchable" android:value=".GlobalSearch" />
</application>
</manifest>

Android: Widgets not showing in app drawer ICS

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)

Categories

Resources