Android: How to lauch an app from browser? - android

I want to launch an activity when a link is clicked on android browser.
I have followed the instructions provided by the link .
When I open the browser and click on the link, the play store is lauched.
This is my href code contained in the html page:
intent://scan/#Intent;scheme=test;package=com.exekon.appbrowser.MainActivity;end
this and this is the code in the manifest:
<activity
android:name=".MainActivity"
android:exported="true"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="test" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Can anyone proved me an example?
Thanks

Look at the zxing source code mentioned in the instructions you used:
<data android:scheme="test" android:host="scan" android:path="/"/>

check the scheme definition into the AndroidManifest.xml
<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="zxing" android:host="scan" android:path="/"/>
</intent-filter>
you must use something like:
<data android:scheme="test" android:host="scan" android:path="/"/>

Related

App links not getting verified in Android

I want to verify my app links as these are directly opening in browser in Android 12. I referred this documentation to verify my app links. But it still shows 0 verified links in my app info. Below is my code of SplashActivity in manifest file
<activity
android:name="in.powerplay.splash.SplashActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="#style/SplashTheme"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<data android:host="portal.getpowerplay.in" />
<data android:host="profile.getpowerplay.in" />
<data android:scheme="https" />
<data android:scheme="http" />
<data android:scheme="app" />
<data android:scheme="pp" />
</intent-filter>
</activity>
I also added the links in assets.json file and you can see in the below screenshots that it's working fine
screenshot 1
screenshot 2
Any help would be appreciated. Thanks in advance!

How can I share an audio from whatsapp to my android app?

I'm trying looking for resources to know how to share audio from WhatsApp to my app, but I can't find any. I only have found how to share from app to WhatsApp but not from WhatsApp do an android app. If you know some resource that may help me, I will be very happy with it.
Cheers!
You should use a intent filter for your problem such as a one below,
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file"/>
<data android:mimeType="audio/*"/>
</intent-filter>
I think the action needs to be changed.
An intent filter must be defined in the Manifest.xml file
After declaring the intent-filter your Manifest.xml will look like this,
<activity android:name=".MainActivity">
<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" />
<data android:scheme="file"/>
<data android:mimeType="audio/*"/>
</intent-filter>
</activity>

Starting my app after QR code has been scanned

I realised an app that read QR code and display result in a modal (then, redirect on a WebView if result is an URL). It works well.
But now what I'd like to do is : When a QR code is scanned with the camera of my device (not my app), then it launch my app and display the result in my modal.
I used intent-filter to do this... And it works well too ! But the problem is that it launchs my app not only if a QR code has been scanned. It launchs my app, for example, when I click on a URL on my phone. And that's not the behavior that I want. I'd like that it starts my app only when a URL has been detected from a QR code. Is it possible ?
Here is my Manifest
<activity
android:launchMode="singleTask"
android:name=".MainActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:scheme="https" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</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="http" android:host="*"/>
<data android:scheme="https" android:host="*"/>
</intent-filter>
<meta-data
android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/nfc_tech_filter" />
</activity>
In order to open your app just for QR code, you'll need to specify custom data schema for your app instead of http and https:
<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="myCustomSchemeName"/>
</intent-filter>
Then QR codes with myCustomSchemeName://openSomething?param=42 will open in your app.

android- url does not open android app

I want to open my application if the url is clicked .I made this href :
<a href="my.special.scheme://other/parameters/here" >open app</a>
in the manifest I did this :
<activity
android:name="com.tejarat.example.Urlchema"
android:label="#string/app_name" >
<intent-filter>
<data android:scheme="my.special.scheme" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
the problem is from url ,When I click on it , it says not found and nothing happens .
Could you help me ? What am I doing wrong ?
Thanks
you can use like this it will work
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="www.youtube.com" android:scheme="http"></data>
</intent-filter>
Try this code it's work for me
<a href='demo://www.abc.com/'>demo://www.abc.com/</a></body></html>
in the manifest
<activity android:name=".myActivity">
<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="demo"/>
</intent-filter>
</activity>

My app is opened when clicking on a URL in Android

I have defined an intent filter in order to launch my app from some kinds of URLs. The point is that it is launched for all the kinds of links, and I only want to be launched for a concrete host name. Here is my manifest:
<activity
android:name="com.imin.SplashActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:logo="#drawable/img_action_icon"
android:screenOrientation="portrait"
android:theme="#style/AppTeme.Fullscreen" >
<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="imintheapp.com"
android:pathPrefix="/events/get/"
android:scheme="http" />
</intent-filter>
</activity>
I need to open my app ONLY in the following cases: http://imintheapp.com/events/get/xxxxxxxx where xxxxxxxx is an alphanumeric string.
What I am doing wrong?
Regards,
Add this code in Menifest.xml
<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.parag-chauhan.com"
android:path="/test"
android:scheme="http" />
</intent-filter>
For test create another project and run below code
Intent i = new Intent(Intent.ACTION_VIEW , Uri.parse("http://www.parag-chauhan.com/test"));
startActivity(i);
You can also pass parameter in link
for more info
http://paragchauhan2010.blogspot.com/2013/03/make-link-in-android-browser-start-up.html
Try this
<data
android:host="imintheapp.com"
android:path="/events/get/"
android:scheme="http" />
I think you should look at the intent-filter element of your Mainfest file. Specifically, take a look at the documentation for the data sub-element.
Read those docs again.
I also suggest you to read the 2nd ans of this Que.

Categories

Resources