How to open activity using Voice Interaction? - android

This is one of my activities in my Android Manifest.
<activity
android:name=".voice.VoiceAccountActivity"
android:label="Qnet Balance"
android:screenOrientation="portrait"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.VOICE" />
<data
android:host="qnet.balance"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I've read the Voice Interactions API but every time I say "Open Qnet Balance" it just shows me a bunch of search results from the web. The Browsable and the data qnet.balance I tried to use it as a way to open my app using voice by saying "Open qnet.balance" but that also failed. Anyone have a solution? I'm talking about calling these commands after doing "Ok Google"

Change intent filter tag. And do try to change label to one word it will work.
<activity android:name=".MainActivity" android:label="race">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.VOICE" />
<data
android:host="qnet.balance"
android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
It opens only launcher activity. I hope this will work

Related

I am creating a Browser App but Android won't detect my app in chooser while I click on any URL

I am creating a Browser app and I want Android to treat my app as a browser and show up in the app chooser to open with.
I want my app to show up in this list.
Here is my manifest Activity code:
<activity
android:name=".Activity.LinkDetectorActivity"
android:exported="true"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="testscheme" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Replace your intent-filter with below,
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http"/>
<category android:name="android.intent.category.DEFAULT" />
<!-- The BROWSABLE category is required to get links from web
pages. -->
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Try to change testcheme to "http" and "https"
<activity
android:name=".Activity.LinkDetectorActivity"
android:exported="true"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<data android:scheme="http" />
<data android:scheme="https" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

Why do I have to separate the <intent-filter> to show the "open" button on google play?

I have an app on GooglePlay, but the Open button is missing. It just says Uninstall.
This is my mainfest.xml:
<application
android:name=".preview_refresh"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher_round"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".Login_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.url.com"
android:path="/launch"
android:scheme="https" />
</intent-filter>
</activity>
</application>
I figured out, the problem is:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
But I have these lines in my code. When I remove:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.url.com"
android:path="/launch"
android:scheme="https" />
the open button is shown.
How can I fix it? I need these tags to open my app via link.
EDIT
I solved my problem, but now I have a new question:
Why do I have to separate the <intent-filter>? It's very confusing, because it shouldn't make any difference.
Ok, now I figured it out. The solution is to separate the <intent-filter>. Like this:
<activity android:name=".Login_Activity">
<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:host="www.urlk.com"
android:path="/launch"
android:scheme="https" />
</intent-filter>
</activity>

App icon missing after implementing Firebase Dynamic Links

After implementing Firebase Dynamic Links, my app icon is missing.
I had combined the suggested intent filter on my main activity, which prevented the app icon from appearing.
Fix this by separating them like so:
<activity
android:name=".activities.SplashActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme">
<!--Main activity intent filter-->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!--Firebase dynamic links-->
<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:host="#string/deep_link_uri"
android:scheme="http" />
<data
android:host="#string/deep_link_uri"
android:scheme="https" />
</intent-filter>
</activity>

I'm trying to open my app on a specific page using deeplinking but it keeps opening the start page

<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="deeplinkingtest"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".resetresponse">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<data android:scheme="https"
android:host="callum.pixelpin.co.uk"
android:pathPrefix="/ResetRequest" />
<data android:scheme="http"
android:host="pixelpin.co.uk"
android:pathPrefix="/SignIn/ResetRequest" />
<data android:scheme="deeplinkingtest"
android:host="resetresponse"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I think it may have to do with the scheme, host and pathPrefix not being correct.
The URL in which the app is checking is as follows:
https://login.pixelpin.co.uk/SignIn/ResetResponse.aspx
Full URL:
https://login.pixelpin.co.uk/SignIn/ResetResponse.aspx?code=OAWIBGOAWO893745OBFAIN&user=4389246
Deeplink class set Like below code and must be remove other All scheme .
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="your scheme" />
</intent-filter>
Include the BROWSABLE category. The BROWSABLE category is required in order for the intent filter to be accessible from a web browser. Without it, clicking a link in a browser cannot resolve to your app. The DEFAULT category is optional, but recommended. Without this category, the activity can be started only with an explicit intent, using your app component name.

How to have two different intent filters for same activity?

Hi I'm integrating two different apps into my app.One is fitbit and other is pinterest.My problem is when ever they are redirected from browser after authentication, I cannot handle intent filters. Here is my code.
<activity
android:name=".DashboardActivity"
android:label="#string/title_activity_dashboard" />
<activity
android:name=".IntegrateActivity"
android:label="#string/title_activity_link_apps"
android:launchMode="singleTask">
<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="Link" />
<data android:host="redirect.html" />
</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="pdkMYID" />
</intent-filter>
</activity>
Only first filter is working. Does anybody know how to handle this,thanks in advance.
I think what you want isn't actually multiple filters but multiple schemas, which is supported.
<activity
android:name=".IntegrateActivity"
android:label="#string/title_activity_link_apps"
android:launchMode="singleTask">
<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="Link" />
<data android:scheme="pdkMYID" />
</intent-filter>
</activity>
That way matching any of those schemas will redirect to your Activity.

Categories

Resources