Android: Avoid duplicate entry when supporting both ACTION_GET_CONTENT and ACTION_OPEN_DOCUMENT -
http://developer.android.com/guide/topics/providers/document-provider.html states:
action_open_document not intended replacement action_get_content. 1 should use depends on needs of app: use action_get_content if want app read/import data. approach, app imports copy of data, such image file. use action_open_document if want app have long term, persistent access documents owned document provider. example photo-editing app lets users edit images stored in document provider.
this indicates apps provides files should support both intent types.
but when app supports both action_get_content
(by having activity matching in intent filter) , action_open_document
(by implementing document provider), shown twice when e.g. attaching a file gmail. due file picking ui showing both document providers , action_get_content
matchers (the latter being shown further down below divider).
is possible avoid duplicate showing of app avoid confusing users?
see below screenshot , box entry showing twice example of problem:
from farther down on same page in supporting devices running android 4.3 , lower section:
the
action_open_document
intent available on devices running android 4.4 , higher. if want application supportaction_get_content
accommodate devices running android 4.3 , lower, should disableaction_get_content
intent filter in manifest devices running android 4.4 or higher. document provider ,action_get_content
should considered mutually exclusive. if support both of them simultaneously, app appear twice in system picker ui, offering 2 different ways of accessing stored data. confusing users.
the section refer on client side - apps connecting documentsprovider
can use both action_get_content
, action_open_document
, no longer need action_get_content
intent-filter or activity @ on android 4.4 , higher devices.
they suggest creating bool
resources based on version code (i.e., in values-v19
) allow change android:enabled
value in manifest, disabling or enabling components based on android version.
Comments
Post a Comment