android-Optimizing Content for the Assistant,Handling App Links
> Optimizing Content for the Assistant
Android 6.0 Marshmallow introduces a new way for users to engage with apps through the assistant.
Users summon the assistant with a long-press on the Home button or by saying the keyphrase
.
》Your app can implement onProvideAssistContent(android.app.assist.AssistContent)
to
improve assistant user experience by providing references to content related to the current activity.
@Override public void onProvideAssistContent(AssistContent assistContent) { super.onProvideAssistContent(assistContent); String structuredJson = new JSONObject() .put("@type", "MusicRecording") .put("@id", "https://example.com/music/recording") .put("name", "Album Title") .toString(); assistContent.setStructuredData(structuredJson); }If neither
onProvideAssistData(android.os.Bundle)
noronProvideAssistContent(android.app.assist.AssistContent)
callbacks
are implemented, the system will still proceed and pass the information collected automatically to the assistant unless the current window is flagged as secure.
As shown in Figure 3, the system uses the default implementations ofonProvideStructure(android.view.ViewStructure)
andonProvideVirtualStructure(android.view.ViewStructure)
to
collect text and view hierarchy information.If neither onProvideAssistData(android.os.Bundle)
noronProvideAssistContent(android.app.assist.AssistContent)
callbacks
are implemented, the system will still proceed and pass the information collected automatically to the assistant unless the current window is flagged as secure.
As shown in Figure 3, the system uses the default implementations ofonProvideStructure(android.view.ViewStructure)
andonProvideVirtualStructure(android.view.ViewStructure)
to
collect text and view hierarchy information.
If your app uses system
alert
windows, it must promptly remove them as leaving them on the screen will degrade user experience and annoy the users.
If neither onProvideAssistData(android.os.Bundle)
noronProvideAssistContent(android.app.assist.AssistContent)
callbacks
are implemented, the system will still proceed and pass the information collected automatically to the assistant unless the current window is flagged as secure.
As shown in Figure 3, the system uses the default implementations ofonProvideStructure(android.view.ViewStructure)
andonProvideVirtualStructure(android.view.ViewStructure)
to
collect text and view hierarchy information.
The assistant app must provide an implementation ofVoiceInteractionSessionService
and VoiceInteractionSession
as
shown in this example
and it requires the BIND_VOICE_INTERACTION
permission.
> Handling App Links
Android 6.0 (API level 23) and higher allow an app to designate itself as the default handler of a given type of link. If the user doesn't want the app to be the default handler,
they can override this behavior fromSettings.
If neither onProvideAssistData(android.os.Bundle)
noronProvideAssistContent(android.app.assist.AssistContent)
callbacks
are implemented, the system will still proceed and pass the information collected automatically to the assistant unless the current window is flagged as secure.
As shown in Figure 3, the system uses the default implementations ofonProvideStructure(android.view.ViewStructure)
andonProvideVirtualStructure(android.view.ViewStructure)
to
collect text and view hierarchy information.
The general steps for creating verified app links are as follows:
- In your app manifest, create intent filters for your website URIs.
- Configure your app to request verification of app links.
- Publish a Digital Asset Links JSON file on your websites to provide verification.
》 When a clicked link or programmatic request invokes a web URI intent, the Android system uses the following criteria, in descending order, to determine how to handle the request:
- The user has set app link associations: If the user has designated an app to handle app links, the system passes the web URI request to that app. A user can set this association in one of two ways: clicking Alwayswhen selecting an app from an app-selection dialog; or, opening Settings > Apps > (gear icon) > App links, selecting an app to use, and setting the app's App links property to the Open in this app option.
- The user has set no association, and there is one supporting app: If the user has not set a preference that matches the web URI request, and there is only one app declaring support for the intent’s URI pattern, the system automatically passes the request to that app.
- The user has set no association, and there are multiple supporting apps: If there are multiple apps declaring support for the web URI pattern, the system displays an app-selection dialog, prompting the user to select the most appropriate app.
<activity ...> <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="http" /> <data android:scheme="https" /> <data android:host="www.android.com" /> </intent-filter> </activity>
<application> <activity android:name=”MainActivity”> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="http" android:host="www.domain1.com" /> <data android:scheme="https" android:host="www.domain1.com" /> </intent-filter> </activity> <activity android:name=”SecondActivity”> <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="https" android:host="www.domain2.com" /> </intent-filter> </activity> </application
Important: The system verifies the JSON file via the encrypted HTTPS protocol. Make sure that
your hosted file is accessible over an HTTPS connection, regardless of whether your app's intent filter includes https
.
》Note: Multiple apps associated with a domain may be signed with the same or different certificates.
[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "example.com.puppies.app", "sha256_cert_fingerprints": ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"] } }, { "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "android_app", "package_name": "example.com.monkeys.app", "sha256_cert_fingerprints": ["14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5"] } }]》This listing indicates which apps are associated with which domains for that user:
Package
- Identifies an app by its package name, as declared in its manifest.Domains
- Shows the full list of hosts whose web links this app handles, using blank spaces as delimiters.Status
- Shows the current link-handling setting for this app. An app that has passed verification, and whose manifest containsandroid:autoVerify="true"
, shows a status ofalways
. The hexadecimal number after this status is related to the Android system's record of the user’s app linkage preferences. This value does not indicate whether verification succeeded.
Note: If a user changes the app link settings for an app before verification is complete, you may see a false positive for a successful verification, even though verification has failed. This verification failure, however, does not matter if the user explicitly enabled the app to open supported links without asking. This is because user preferences take precedence over programmatic verification (or lack of it). As a result, the link goes directly to your app, without showing a dialog, just as if verification had succeeded.
onProvideAssistData(android.os.Bundle)
noronProvideAssistContent(android.app.assist.AssistContent)
callbacks
are implemented, the system will still proceed and pass the information collected automatically to the assistant unless the current window is flagged as secure.
As shown in Figure 3, the system uses the default implementations ofonProvideStructure(android.view.ViewStructure)
andonProvideVirtualStructure(android.view.ViewStructure)
to
collect text and view hierarchy information.相關文章
- Invoking Oracle Patch Application Assistant....OracleAPP
- android-Making Your App Content Searchable by Google,Specifying App Content for IndexingAndroidAPPGoIndex
- topic links
- iOS 9上的網頁喚醒APP(Universal Links)iOS網頁APP
- Links, Symbolic or OtherwiseSymbol
- Good Links related OracleGoOracle
- iOS Universal Links實現微信內網頁跳轉至App的方案iOS內網網頁APP
- content = content==null? content="":content; 三目運算子用法例項Null
- Cookie Handling in WinHTTPCookieHTTP
- 《Predict Anchor Links across Social Networks via an Embedding Approach》閱讀筆記ROSAPP筆記
- oracle中database links的使用OracleDatabase
- Database links of distributed oracle systemDatabaseOracle
- RxJava Error Handling OperatorsRxJavaError
- Handling Error ConditionsError
- iOS 9 通用連結(Universal Links)iOS
- Oracle SQL performance with database links - dblinkOracleSQLORMDatabase
- Multi-path handling for asmASM
- uniapp uni.showModal的content實現換行顯示APP
- CSS contentCSS
- SCSS @contentCSS
- SAP UI5的support AssistantUI
- Database Links 全面瞭解---轉MetalinkDatabase
- Oracle DB Links學習與測試Oracle
- Exception Handling in Asp.net MVCExceptionASP.NETMVC
- PL/SQL Tutorials - HANDLING ERRORS AND EXCEPTIONSSQLErrorException
- 注意 AppResLib.dll.*.mui 的生成操作應該為 ContentAPPUI
- Handling ORA-1403 ora-12801 on logical standby apply [ID 1178284.1]APP
- 通用連結(Universal Links)實踐筆記筆記
- Content Security Policy
- ISO in CSS contentCSS
- 瀏覽器中喚起native app || 跳轉到應用商城下載(二) 之universal links瀏覽器APP
- Handling duplicate form submission in Spring MVCORMSpringMVC
- Netty series: handling CORS in nettyNettyCORS
- Android TV-Handling TV HardwareAndroid
- Laf Assistant:雲開發從未如此爽快!
- System Administration Assistant[t-code]SSAA
- SAP Fiori 的附件處理(Attachment handling)
- CSS justify-contentCSS