You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.1 KiB
80 lines
3.1 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
|
Copyright 2015 The Android Open Source Project
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
-->
|
|
<sample>
|
|
<name>DirectShare</name>
|
|
<group>Content</group>
|
|
<package>com.example.android.directshare</package>
|
|
|
|
<minSdk>23</minSdk>
|
|
|
|
<strings>
|
|
<intro>
|
|
<![CDATA[
|
|
This sample demonstrates how to provide the Direct Share feature. The app shows some options
|
|
directly in the list of share intent candidates.
|
|
]]>
|
|
</intro>
|
|
</strings>
|
|
|
|
<template src="base"/>
|
|
|
|
<metadata>
|
|
<status>PUBLISHED</status>
|
|
<categories>Content</categories>
|
|
<technologies>Android</technologies>
|
|
<languages>Java</languages>
|
|
<solutions>Mobile</solutions>
|
|
<level>INTERMEDIATE</level>
|
|
<icon>screenshots/icon-web.png</icon>
|
|
<screenshots>
|
|
<img>screenshots/1-main.png</img>
|
|
<img>screenshots/2-intent.png</img>
|
|
<img>screenshots/3-message.png</img>
|
|
</screenshots>
|
|
<api_refs>
|
|
<android>android.service.chooser.ChooserTargetService</android>
|
|
<android>android.service.chooser.ChooserTarget</android>
|
|
</api_refs>
|
|
<description>
|
|
<![CDATA[
|
|
Sample demonstrating how to show some options directly in the list of share intent candidates.
|
|
]]>
|
|
</description>
|
|
<intro>
|
|
<![CDATA[
|
|
[Direct Share][1] is a feature that allows apps to show their internal options directly in the
|
|
system Intent chooser dialog. This sample is a dummy messaging app, and just like any other
|
|
messaging apps, it receives intents for sharing a plain text. When a user shares some text from some
|
|
other app, this sample app will be listed as an option. Using the Direct Share feature, this app
|
|
also shows some of contacts directly in the chooser dialog.
|
|
|
|
To enable Direct Share, apps need to implement a Service extending
|
|
[ChooserTargetService][2]. Override the method [onGetChooserTargets][3] and return a list of Direct
|
|
Share options.
|
|
|
|
In your AndroidManifest.xml, add a meta-data tag in your Activity that receives the Intent. Specify
|
|
android:name as android.service.chooser.chooser_target_service, and point the android:value to the
|
|
Service.
|
|
|
|
[1]: https://developer.android.com/reference/android/service/chooser/package-summary.html
|
|
[2]: https://developer.android.com/reference/android/service/chooser/ChooserTargetService.html
|
|
[3]: https://developer.android.com/reference/android/service/chooser/ChooserTargetService.html#onGetChooserTargets(android.content.ComponentName%2C%20android.content.IntentFilter)
|
|
]]>
|
|
</intro>
|
|
</metadata>
|
|
</sample>
|