• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2014 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<sample>
18    <name>CommitContentSampleIME</name>
19    <group>Input</group>
20    <package>com.example.android.commitcontent.ime</package>
21
22    <minSdk>25</minSdk>
23
24    <strings>
25        <intro>
26            <![CDATA[
27                This sample demonstrates how to write an keyboard which sends rich content
28                (such as images) to text fields using the Commit Content API.
29            ]]>
30        </intro>
31    </strings>
32
33    <template src="base-build" />
34
35    <metadata>
36        <status>PUBLISHED</status>
37        <categories>System</categories>
38        <technologies>Android</technologies>
39        <languages>Java</languages>
40        <solutions>Mobile</solutions>
41        <level>INTERMEDIATE</level>
42        <icon>screenshots/icon-web.png</icon>
43        <screenshots>
44            <img>screenshots/screenshot-1.png</img>
45        </screenshots>
46        <api_refs>
47            <android>android.widget.EditText</android>
48            <android>import android.support.v13.view.inputmethod.EditorInfoCompat</android>
49            <android>import android.support.v13.view.inputmethod.InputConnectionCompat</android>
50            <android>import android.support.v13.view.inputmethod.InputContentInfoCompat</android>
51        </api_refs>
52
53        <description>
54<![CDATA[
55This sample demonstrates how to write an keyboard which sends rich content (such as images) to text
56fields using the Commit Content API.
57]]>
58        </description>
59
60        <intro>
61<![CDATA[
62Users often want to communicate with emojis, stickers, and other kinds of rich content. In previous
63versions of Android, soft keyboards (input method editors or IMEs) could send only unicode emoji to
64apps. For rich content (such as images), apps had to either build app-specific APIs that couldn't
65be used in other apps or use workarounds like sending images through the Easy Share Action or the
66clipboard.
67
68Now in Android 7.1 (API 25), the Android SDK includes the [Commit Content API][1], which provides a
69universal way for IMEs to send images and other rich content directly to a text editor in an app.
70The API is also available in the v13 Support Library (ver. 25.0), supporting devices as early as
71Android 3.2 (API 13).
72
73With this API, you can build messaging apps that accept rich content from any keyboard, as well as
74keyboards that can send rich content to any app.
75
76**Note:** This sample does not have a default Activity. After installing it, you will need to enable
77this app as a keyboard by navigating to *Settings > Languages & Input > Virtual Keyboard > Manage
78Keyboards*. This keyboard can then be accessed by pressing the virtual keyboard icon in the
79lower-right hand corner of the display while in a text field.
80
81[1]: https://android-dot-devsite.googleplex.com/preview/image-keyboard.html
82]]>
83        </intro>
84    </metadata>
85</sample>
86