Voice Action Activity - android

Although I'm using Xamarin, I believe this to be a general Android development question. I'm developing an app, let's say "My App," that I'd like to be launched via the launcher and via voice using "Ok Google, start My App."
What I'd like to accomplish is to start MainActivity or VoiceActivity depending on the mode in which my app is launched. I found this blog post https://blog.xamarin.com/add-a-conversation-to-your-android-app-with-voice-interactions/ by James Montemagno but whenever I activate My App via "OK Google" it always starts at MainActivity.
I'm hoping someone can provide pointers on what intent-filters to add in order to accomplish this. Here's what I have so far:
<activity android:icon="#drawable/icon" android:label="My App" android:name="md593b8d625023f6802361dd1b8a6546be5.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:label="My App" android:name="md593b8d625023f6802361dd1b8a6546be5.VoiceActivity">
<intent-filter>
<action android:name="android.intent.action.VOICE_COMMAND" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE" />
</intent-filter>
</activity>
I've also read older documentation/reports of apps needing to be made publicly available in the Google Play store to be indexed before "Ok Google" works correctly, but it's not clear if those are for custom actions or something as simple as launching an app via voice.
Thanks in advance for any insight you can provide, I've been banging my head trying to figure out what should be seemingly very easy...
Thanks,
Ryan

Related

Deep linking working with adb, not in browser

I have setup deep linking in my app previously and had it work just fine. All the sudden it stops working. I have the below manifest...
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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.giftwizit.com" />
</intent-filter>
<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="giftwi" android:host="Products" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
When I attempt to load https://www.giftwizit.com in a browser such as Chrome or even Samsung internet it simply loads up a google search page. The same happens when I attempt giftwi://Products.
What's interesting to me is when I run the adb command like...
all is good... the launcher shows up and asks which app I'd like to open the link with.
Now I am using app-auth, and I know that it has me make this entry into the build.gradle file, but I've had this before and had everything work just fine.
This snippet is from within the defaultConfig inside the build.gradle file, and is how the react-native-app-auth documentation says it should be. I just thought I'd include this to be as transparent as possible.
Hoping to get some help on this. I have noticed at least one other post where some guy was having the same problem years ago, but it hasn't received any answers.
The reason for not able to redirect while typing/pasting URL in your browser is due to a bug in Chrome browser itself. but that turned out to be an functionality and adopted by some other browsers as well
You can check the bug here, and look at the status: WontFix (Closed).
Now the reason behind all this according to them,
If a user typing/pasting URL in browser then the user really want to go that URL, instead being redirected on a application
So your deep linking is working fine, best way to test it, share the link and then click on it
And also this always redirection really caused problem as well, when user was not able to go on the website due to redirection, you can also check a bug report here due to this always redirection, status is now Fixed (Closed) for it

Put my app in the Google Now Phone search list (Android Global Search)

I want to make my app searchable in the Google Now quick search box. I followed some examples but it still doesn't work. The official doc isn't clear at all about how to make this case work.
Now after checking these stackoverflow issues, I start wondering if this feature is still available to the developer?
Is global search in android still available for developer?
How do I get my app to appear in Google Now's Phone Search list?
I do see a few apps still make into the "Phone search" list in the quick search box settings. If so, anyone can shed some light for me? My searchable config xml is as follows
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/app_name"
android:hint="#string/search_hint"
android:searchSuggestAuthority="#string/search_authority"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://some_search_authority"
android:includeInGlobalSearch="true">
</searchable>
In this AndroidManifest.xml file, I do have meta-data specified for the SearchableActivity e.g.
<activity ...>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
It's not possible (at least, yet).
Google Music has a Google Now card and to have something similar, you need to create your own.
Unfortunately, it has no public API yet: Google Now integrations
Now cards from apps are currently under development and are not available to all apps. We'll let you know when we are able to onboard more partners.
What you can do is to add your app into the list of suggestion for command "Play (Band name) (Song name)":
To make this happen, you have to add intent-fiters to your Activity, which should be opened to AndroidManifest:
<activity
android:name=".MusicActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.media.action.MEDIA_PLAY_FROM_SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You can check out list of Google Now voice commands here: A list of all the Google Now voice commands
I hope, it helps

Making WebView a Default phone browsaer

I have been searching the web, and I still can’t find the answer. I have an Android app with a WebView, I am trying to make my activity the default browser for the phone. Therefore when I do a Google search in the Google search widget, it should pass the results into my WebView.
I am new to android development any examples would be highly grateful.
What I believe you are trying to ask is how to subscribe your application to intents for launching web URIs. In order to do so, you can add an intent filter to your application's manifest.
There's an example of this on Lars Vogel's blog. It boils down to this:
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".BrowserActivitiy"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>
</activity>
</application>

Running Google Glass sample app on Android Virtual Device(emulator)

I am trying to run the Timer sample google glass app, but when I run the project, it gets installed and then says DONE, however, I don't see anything on the emulator. I know there is no Launcher and so I tried the RUN CONFIGURATION but I don't see any activity in the dropdown when I chose the Launch option. Any thoughts or guides on to do this ?
First of all there is no avd/emulator available for Glass.But if still you are interested converting your mobile phone into glass.Check these link i.e 1,2,3.But no one works completely treating your phone as Glass.
As you have mentioned above that you try to install an app on emulator.The main reason why it is not showing up is that:
Move to AndroidManifest.xml
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
This is the normal code for the main launcher activity of android.This is the main activity which is launched in the emulator/avd
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
While in Glass code you find something like this.There is no launcher in Glass but still you can add.Here you only found out the voice trigger which open your app
<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="#xml/voicetrigger" />
</activity>

uninstall Application Password Protected

How to start an Activity or an IntentService before an application will be uninstalled by the user who has earlier installed the app on there device?
One way to achieve what you want would include the following steps:
(temporarily) rooting the device
converting the app in question into a system app (e.g. using Titanium Backup ★ root, but there are also other apps helping you with this step)
unroot the device again
As the app now resides in read-only space (/system), the user cannot delete it without either rooting the device or flashing a ROM -- which of course could be done, but it's a higher inhibition threshold at least.
There is no such thing as impossible with computers. There is only difficult and highly improbable to happen anytime soon. This is a fact not an opinion. Often someone says "impossible" and there is someone interrupting them saying "Just did it.".
You cannot prefend an user removing an application.
The DELETE intent will be send when the user requests to uninstall.
The PackageManager will receive this intent and start uninstalling the application.
So, without any Android modifications, you cannot add an password.
You have to use Intent filter called "android.intent.action.DELETE" in the AndroidManifest.xml
Like below
<activity
android:name=".Activity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DELETE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="package" />
</intent-filter>
</activity>
This will call the activity.

Categories

Resources