android-Making Your App Content Searchable by Google,Specifying App Content for Indexing
As mobile apps become more pervasive, users are looking for relevant information not only from web sites but also from apps they have installed. You can enable Google to crawl
through your app content and present your Android app as a destination to users through Google Search results, when that content corresponds to a web page that you own.
To enable Google Search app indexing, you need to provide Google with information about the relationship between your app and web site. This process involves the following steps:
- Enable deep linking to specific content in your app by adding intent filters in your app manifest.
- Annotate these links in the associated web pages on your web site or in a Sitemap file.
- Opt in to allow Googlebot to crawl through your APK in the Google Play store to index your app content. You are automatically opted-in when you join as a participant in the early adopter program.
To enable Google to crawl your app content and allow users to enter your app from search results, you must add intent filters for the relevant activities in your app manifest.
These intent filters allow deep linking to the content in any of your activities.
> The URIs “example://gizmos”
and “http://www.example.com/gizmos”
both resolve to this activity.
<activity android:name="com.example.android.GizmosActivity" android:label="@string/title_gizmos" > <intent-filter android:label="@string/filter_title_viewgizmos"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <!-- Accepts URIs that begin with "http://www.example.com/gizmos” --> <data android:scheme="http" android:host="www.example.com" android:pathPrefix="/gizmos" /> <!-- note that the leading "/" is required for pathPrefix--> <!-- Accepts URIs that begin with "example://gizmos” --> <data android:scheme="example" android:host="gizmos" /> </intent-filter> </activity>Note: Intent filters may only contain a single
data
element
for a URI pattern. Create separate intent filters to capture additional URI patterns.@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Intent intent = getIntent(); String action = intent.getAction(); Uri data = intent.getData(); }
Follow these best practices to improve the user's experience:
- The deep link should take users directly to the content, without any prompts, interstitial pages, or logins. Make sure that users can see the app content even if they never previously opened the application. It is okay to prompt users on subsequent interactions or when they open the app from the Launcher. This is the same principle as the first click free experience for web sites.
- Follow the design guidance described in Navigation with Back and Up so that your app matches users' expectations for backward navigation after they enter your app through a deep link.
Google's web crawling bot (Googlebot),
which crawls and indexes web sites for the Google search engine, can also index content in your Android app. By opting in, you can allow Googlebot to crawl the content in the APK through the Google Play Store to index the app content. To indicate which app
content you’d like Google to index, simply add link elements either to your existingSitemap file
or in the <head>
element of each web page in your site, in the same way as you would for web pages.
> The components that make up the URI format are:
- package_name. Represents the package name for your APK as listed in the Google Play Developer Console.
- scheme. The URI scheme that matches your intent filter.
- host_path. Identifies the specific content within your application.
<loc>
tag,
and a corresponding deep link to your Android app by using the <xhtml:link>
tag.
<?xml version="1.0" encoding="UTF-8" ?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml"> <url> <loc>example://gizmos</loc> <xhtml:link rel="alternate" href="android-app://com.example.android/example/gizmos" /> </url> ... </urlset>
>Typically, you control how Googlebot crawls publicly accessible URLs on your site by using a robots.txt
file.
When Googlebot indexes your app content, your app might make HTTP requests as part of its normal operations. However, these requests will appear to your servers as originating from Googlebot. Therefore, you must configure your server's robots.txt
file
properly to allow these requests.
For example, the following robots.txt
directive shows how you might allow access to a specific directory in your web site (for example, /api/
) that your app needs to access, while restricting Googlebot's access to
other parts of your site.
User-Agent: Googlebot Allow: /api/ Disallow: /
To learn more about how to modify robots.txt
to control web crawling, see the Controlling
Crawling and Indexing Getting Started guide.
相關文章
- [Bash] Append the content at the beginning of the fileAPP
- Boost Your Strategy With The Content Marketing Tools
- content = content==null? content="":content; 三目運算子用法例項Null
- uniapp uni.showModal的content實現換行顯示APP
- CSS contentCSS
- SCSS @contentCSS
- 圖書搜尋:Google 和 Open Content AllianceGo
- 注意 AppResLib.dll.*.mui 的生成操作應該為 ContentAPPUI
- Content Security Policy
- ISO in CSS contentCSS
- android-Optimizing Content for the Assistant,Handling App LinksAndroidAPP
- Running the app on your deviceAPPdev
- CSS justify-contentCSS
- file_get_content
- iOS autolayout的Content Hugging 和 Content Compression ResistanceiOS
- python迴圈遍歷字典: title_content_list.append([key, value])print(tiPythonAPP
- CSS align-contentCSS
- content_for in rails3AIS3
- Content-Type一覽
- android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetAndroidXMLIDE
- android TV-Making TV Apps Searchable,Searching within TV AppsAndroidAPP
- Protecting Your Database: Specifying Passwords for Users SYS and SYSTEM (70)Database
- file_get_content s()獲取https出現這個錯誤Unable to find the wrapperHTTPAPP
- 理解CSS3 max/min-content及fit-content等width值CSSS3
- Android中Content ProviderAndroidIDE
- Android Content Provider SecurityAndroidIDE
- 理解HTTP之 content-typeHTTP
- http Content-Type 知多少HTTP
- Content Security Policy (CSP) 介紹
- HTTP Content-Type型別HTTP型別
- Content Security Policy 入門教程
- http content-type總結HTTP
- Standard directory layout for maven project contentMavenProject
- Content Linking元件[Asp]元件
- Writing your first Django app, part 1DjangoAPP
- iOS AutoLayout進階(四)Content Hugging Priority和Content Compression Resist綜合運用iOS
- Django中content_type的使用Django
- read content in a text file in pythonPython