I have a custom intent for app actions to say something like these sentences:
Hey Google, open MyCookingApp to bake a Cake for 10 minutes
Hey Google, open MyCookingApp to bake a Pizza for 15 minutes
Hey Google, open MyCookingApp to bake a Pizza (here the user doesn't specify any time)
To do this I use this custom intent:
<action intentName="custom.actions.intent.BAKE_SOMETHING" queryPatterns="#array/ExampleQueries">
<!-- Define parameters -->
<parameter name="text1" type="https://schema.org/Text" />
<parameter name="number1" type="https://schema.org/Number" />
<!-- Define fulfillment -->
<fulfillment urlTemplate="https://my.app.com/{?item_name,number_of_minutes}">
<parameter-mapping intentParameter="text1" urlParameter="item_name" />
<parameter-mapping intentParameter="number1" urlParameter="number_of_minutes" />
</fulfillment>
</action>
And this is the ExampleQueries:
<string-array name="ExampleQueries">
<item>bake a $text1</item>
<item>bake a $text1 for $number1 minutes</item>
</string-array>
If I just say "open MyCookingApp to bake a Pizza" then I get item_name="Pizza" and number_of_minutes=null, which is correct!!
But if I say "open MyCookingApp to bake a Pizza for 15 minutes" then I get item_name="Pizza for 15 minutes" and number_of_minutes=15, which is WRONG!! Why do I get "Pizza for 15 minutes" as the the first parameter?
I have tried to have 2 different custom intents. One for only the item "bake a $text1" and another one for the item "bake a $text1 for $number1 minutes" but I get same results. It seems like the Assistant takes the "easiest" way. I mean, if "bake a $text1" is provided, then everything after "bake a" will be considered a string. But in this case why do I get a real value for number_of_minutes? It should be null, right?
Any body can show some light here. Basically I need to ask the users for a first string value, and then an optional number.
Related
We have implemented android shortcuts. Testing of App actions on physical devices was fine, except for an issue with English Articles.
When English Articles appear as a part of a statement, the statement is not recognized as an action, and Assistant does not redirected to the app. For example, 'add note to Express Scheduler' is recognized, while 'add a note to Express Scheduler' is not.
My question is whether anybody have experienced similar issues?
Please, see capabilities segment extracted from shortcuts.xml. I am using actions.intent.CREATE_THING and actions.intent.GET_THING BIIs. I've listed one example above: 'add note to Express Scheduler' is recognized, while 'add a note to Express Scheduler' is not.
<capability android:name="actions.intent.CREATE_THING">
<intent>
<url-template android:value="https://vijac.ca/schedule{?name,description}" />
<parameter
android:name="thing.name"
android:key="name"
android:required="false" />
<parameter
android:name="thing.description"
android:key="description"
android:required="false" />
</intent>
</capability>
<capability android:name="actions.intent.GET_THING">
<intent>
<url-template android:value="https://vijac.ca/search{?name}" />
<parameter
android:name="thing.name"
android:key="name" />
</intent>
</capability>enter code here
Thank you!
I think what may be happening is that you have a very generic name of the thing ("a note"), when it is expecting to handle specific names which normally don't need an article ("Pixel 4", "Stairway to Heaven").
You may want to try one of these to address the problem:
The thing.name parameter for that BII allows for an inline inventory which is a way of setting allowable values and alises for those values. You can create an inventory item for note that has aliases such as "a note" and "note".
Consider using the actions.intent.CREATE_DIGITAL_DOCUMENT BII which indicates that it supports phrases such as "Create a note".
Google's official document says actions.intent.OPEN_APP_FEATURE supports only urlTemplate set to "{#url}" with no fallback fulfillment.
The following is their sample code for actions.xml:
<?xml version="1.0" encoding="utf-8"?>
<!-- This is a sample actions.xml -->
<actions>
<action intentName="actions.intent.OPEN_APP_FEATURE">
<!-- Use url from inventory match for deep link fulfillment -->
<fulfillment urlTemplate="{#url}" />
<!-- Define parameters with inventories here -->
<parameter name="feature">
<entity-set-reference entitySetId="featureParamEntitySet"/>
</parameter>
</action>
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/one" name="featureParam_one" alternateName="#array/featureParam_one_synonyms"/>
<entity url="myapp://deeplink/two" name="featureParam_two" alternateName="#array/featureParam_two_synonyms"/>
</entity-set>
</actions>
It means that I can say "Open featureParam_two from myapp" to start the app with deep link "myapp://deeplink/two".
If the app has user-defined names such as "front door", "first bathroom", how can those names be passed to the app to allow users to say "open front door from myapp" or "open first bathroom from myapp" to open the app and the corresponding feature?
You can use alternate names/synonyms to define those features.
For example, you can use the following definition:
<entity-set entitySetId="featureParamEntitySet">
<!-- Provide a URL per entity -->
<entity url="myapp://deeplink/front-door" name="front door" alternateName="#array/front-door-synonyms"/>
<entity url="myapp://deeplink/two" name="first bathrooms" alternateName="#array/first-bathroom-synonyms"/>
</entity-set>
As you can see here, the phone number here is starting from the right to the left.
However, I want it to display it like this (Image here is edited):
This is the TextView displaying this message:
<TextView
android:text="#string/smsSentTo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/smsSentTo"
android:textColor="#color/mdtp_white"
android:textSize="18sp"
android:layout_above="#+id/chooseUsernameAndPickProfilePicture"
android:layout_centerHorizontal="true"
android:layout_marginBottom="24dp"/>
#string/smsSentTo (Arabic locale): (looks like StackOverflow is displaying the {0} wrong, ignore that.)
<string name="smsSentTo">تم إرسال رسالة SMS إلى {0}</string>
#string/smsSentTo (English locale):
<string name="smsSentTo">An SMS has been sent to {0}</string>
As you can see, I'm formatting the text using MessageFormat:
String smsSentTo = MessageFormat.format(smsSentToTV.getText().toString(), phone);
smsSentToTV.setText(smsSentTo);
How can I get it to display these properly?
There is a solution with a downside
String html = "<p>تم إرسال رسالة SMS إلي</p>" + "+961 01 234 567";
textView.setText(Html.fromHtml(html));
The downside is that the HTML p tag prints a line afterwards separating the number into the next line. I tried to remove it with some HTML attributes or using tags other than p tag, but that didn't work
Hope this satisfies your need, or can give you even a clue.
In 2 seperate web applications, one using asp.net 3.5 with vs2008 and 4.0 with vs2010, the child menu items of an asp.net menu dissappear only on android browser. When the main menu item is clicked the children flash for a split second then dissappear.
Edited version of menu is as follows:
<asp:Menu ID="MainMenuEmp" runat="server" CssClass="menuASP" Orientation="Horizontal" DynamicHorizontalOffset="0"
StaticDisplayLevels="1" StaticEnableDefaultPopOutImage="false" DynamicVerticalOffset="1" visible="false"
>
<StaticMenuitemStyle CssClass="menuitemASPStatic" />
<StaticHoverStyle CssClass="menuASPStaticHover" />
<StaticSelectedStyle CssClass="menuASPStaticHover" />
<DynamicMenuStyle CssClass="menuASPDynamicMenuStyle" />
<DynamicMenuitemStyle CssClass="menuitemASPDynamic" />
<DynamicHoverStyle CssClass="menuASPDynamicHover" />
<DynamicSelectedStyle CssClass="menuASPDynamicHover" />
<Items>
<asp:MenuItem Text="HISTORY" Value="#" navigateurl="~/clientpages/jobhistory.aspx" />
<asp:MenuItem Text="NEW ORDER" Value="#" navigateurl="~/clientpages/newjob.aspx" />
<asp:MenuItem Text="CLIENT INFO" Value="#" navigateurl="~/clientpages/clientinfo.aspx" />
<asp:MenuItem Text="MGMT" Value="#" Selectable="false" >
<asp:MenuItem Text="Inspections" Value="#" navigateurl="~/clientpages/MgrInspection.aspx" />
<asp:MenuItem Text="Tasks" Value="#" navigateurl="~/clientpages/MgrInspectionStatus.aspx"/>
<asp:MenuItem Text="Last Vehicle Inspection" Value="#" navigateurl="~/clientpages/MgrInspectionVehicle.aspx"/>
</asp:MenuItem >
<asp:MenuItem Text="JOB MGMT" Value="#" navigateurl="~/clientpages/jobdailyview.aspx"/>
</Items>
</asp:Menu>
partial css is as follows: (z-index is needed to get sub menu's to show on other browsers).
.menuASPDynamicMenuStyle
{
z-index: 999; /*padding: 4px 0 3px 0;*/
padding: 0;
margin-top: 1px;
background-color: #F8F8F8;
}
Menu is on master page with toolscriptmanager on page.
The following code is in init event of masterpage:
If Request.ServerVariables("http_user_agent").IndexOf("Safari", StringComparison.CurrentCultureIgnoreCase) <> -1 Then
Page.ClientTarget = "uplevel"
End If
This was necessary to get child menu's to show on other browsers as well. I tried:
page.clienttarget = "uplevel"
without the condition, but, this did not work.
I have also tried adding an android browser file, but, this did not work.
I have scoured the web for a few days. There a few similar questions, but, no answers. Has anyone had same problem? The menu works fine in ie, chrome, ff, safari, ipad, but, not on android mobile devices and not on android tablets.
There is no hover on an Android but my asp menu works if I hold down on the parent menu. Sadly I also get the browser menu when I hold down on it. You will have to design a menu that opens the child items with a single click. This cannot be done with the asp menu.
menus are not disappearing but the page is posting back..
just set navigateUrl property to 'javascript:return false'
I found a way to fix this.
Either do
document.body.setAttribute('onclick', 'setTimeout(function () { }, 0);');
in a startup script
or let the body tag look like this
<body onclick="setTimeout(function () { }, 0);">
Then it works on Android. I haven't tested on other iPhone or so.
(I have also tried some more conventional ways of adding this dummy script, but it did not work.)
Hi I'm having a problem with my xml file for my android app. It's spitting out this error
error: invalid start tag Category . . . here is the source code.
<?xml version="1.0" encoding="UTF-8" ?>
<Category>
<destination id="1" main_cat="Hotel">
<timestamp></timestamp>
<business_name><![CDATA[ Sugarland Hotel ]]></business_name>
<alias><![CDATA[ Sugarland Hotel ]]></alias>
<address><![CDATA[ Araneta Avenue ]]></address>
<city><![CDATA[ Bacolod ]]></city>
<subcategory><![CDATA[ Hotel ]]></subcategory>
<cuisine><![CDATA[ Italian,Asian ]]></cuisine>
<budget> </budget>
<features> </features>
<working_days><![CDATA[ Everyday ]]></working_days>
<opening><![CDATA[ 24/7 ]]></opening>
<ending> </ending>
<contact><![CDATA[ (34)435-2690 , (34)435-2780 ]]></contact>
<fax><![CDATA[ (34)435-2645 ]]></fax>
<email><![CDATA[ rooms#sugarlandhotel.com ]]></email>
<website><![CDATA[ www.sugarlandhotel.com ]]></website>
<payment_type><![CDATA[ cash,credit card,master card, visa ]]></payment_type>
<lat><![CDATA[ 10.6524789N ]]></lat>
<long><![CDATA[ 122.9372838E ]]></long>
<desc><![CDATA[ Experience a modern hacienda retreat that nurtures the charm and romance of old world plantation living. Extensively renovated beginning 2010, Sugarland hotel unvails a celebrated balance of nostalgia and contemporary style, Capturing its original southern elegence, luxury, and decadence. Machuca tiles form cool geometric patterns in the hallways. Hacienda hardwoord floors contrast modern furnishings and amenities in the dramatic suits. The sugarland lifestyle offers guests the finest sensory indulgences: signature hacienda service, soothing organic toiletries, heirloom recipes, and unmatched privacy and tranquility. ]]></desc>
<image> </image>
</destination>
</Category>
also i tried testing CDATA would i rather use it or go with xml schema. Thanks for the help in advance
Remove the whitespace in front of <?xml version="1.0" encoding="UTF-8" ?>. Nothing can appear before it.
Both IntelliJ and my browser say your XML is fine. There must be something else wrong.