I am developing an application on Android and my application needs to be launched whenever a URI like (myscheme://mydata) is clicked on an SMS or Email.
I am using following filter for my app :
<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="secture"/>
</intent-filter>
However on emails and SMS messages, my URIs with the form of myscheme://mydata show up as
regular tests and i cannot click on them to launch my application.
Thanks for help
Edit :
I found out that Linkfy class does something similar however it modifies your own text into links. What I need is modifying other applications such as Email and SMS. So is it possible to change another applications Linkfy?
So is it possible to change another applications Linkfy?
No, sorry.
Instead of myscheme://mydata, use http://mydomain/mypath. You can create an <intent-filter> for this so that you get control instead of the browser, and the resulting URLs will be friendlier to other apps. As a bonus, you can put a real Web page at that URL, so if somebody who does not have your app winds up with your URL (e.g., forwarded email), the URL will still work..
Related
I want to launch a specific android app through a NFC card. I don't want android to ask me which app should be opened. It should instantly open my app. How could I do that?
I already tried it with MIME-Types but it did not work. Could i specify my own MIME-Type? Would it be possible to check the MIME-Type text/plain for a specific text(intent filter?)?
For example: I want my app to start when the NFC card has a specific text stored like "test" or something.
The idea is that it should work on every common mobile OS. Therefore an android application link would not work.
You can create your own application mimeType.
You could create a custom mimeType in your NDEF message and then create an intent-filter which matches it exactly. This would mean your app would be launched as it is the most specific filter.
Example:
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/vnd.com.my.app.package.customString" />
</intent-filter>
Taken from a previous example I've provided here: https://stackoverflow.com/a/27397938/3312868
Suppose we have an activity to resolve external URL links with a specifix pathPrefix. It's not a problem. The problem is to have a method to make those links is only resolvable with my app.
For example:
We have this 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="example.com"
android:pathPrefix="/specific_prefix/"
android:scheme="http" />
</intent-filter>
And I want only my app to be used for example for "example.com/specific_prefix/etc". If that eve possible?
And I want only my app to be used for example for "example.com/specific_prefix/etc". If that eve possible?
No.
First, how URLs are interpreted is up to the app interpreting the URLs. Some Web browsers, when they encounter an http URL, will always handle it themselves, rather than seeing if a third-party app has advertised support for it.
Second, in cases where there are two or more apps that claim to support a certain operation, the user chooses which one to use. In your case, Web browsers and your app will claim to handle that URL, and the user can choose whichever of those that the user wants.
With Android 6.0's app links, you can avoid the chooser by default, so if a chooser would have appeared, the user will be taken straight to your app. The user can disable this in Settings, though.
I couldn't find anything on this. I read everything about protocol/content handlers but didn't seem to solve my problem at all.
I'm trying to find a way to allow an Android user (for example) to share content using a web application.
Examples:
1) Viewing a Youtube video in the native app. User selects 'share' and a bunch of icons appear. I want my web app to be there, so when user selects its icon, a URL is opened in the browser with a magic parameter passing the video URL so I can handle that.
2) Well, you get the idea now :)
Any ideas?
Thanks.
If your app can do some task and you want that message to be conveyed to all other apps, Android way of doing this is - Intent Filters (It tells the world what the app can do)
Intent - Android way of telling - Hey i want to get this job done ?
If you build a social app that can share messages or photos with the user's friends, your app should support the ACTION_SEND intent. so users can initiate a "share" action from another app and launch your app to perform the action.
To allow other apps to start your activity, you need to add an element in your manifest file for the corresponding element.
If your activity handles both text and images for both the ACTION_SEND and ACTION_SENDTO intents. In this case, you must define two separate intent filters for the two actions because a ACTION_SENDTO intent must use the data Uri to specify the recipient's address using the send or sendto URI scheme. For example:
<activity android:name="ShareActivity">
<!-- filter for sending text; accepts SENDTO action with sms URI schemes -->
<intent-filter>
<action android:name="android.intent.action.SENDTO"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
<!-- filter for sending text or images; accepts SEND action and text or image data -->
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
This link has all the above mentioned details with lot more information.
http://developer.android.com/training/basics/intents/filters.html
I'm developing a small gallery application, in this application im getting images from sdcard and im displaying those images in my application and I completed this app successfully. My requirement is "When the user select some default app in the phone a chooser list is displaying, I want to add my app into that list". I have searched this in website but I couldn't get any solution for this. Please anyone help me
You must let your application respond to a type of intents. This is done by registering an Broadcast Receiver that filters a type of intent using an intent-filter. An example is shown here: http://developer.android.com/guide/topics/intents/intents-filters.html. I hope that i understood your question. If not, please elaborate on your problem.
try this it is works for me,
place this intent filter in your manifest file, and menction in which activity is support that action.
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
Hi
Is it possible to invoke an Android App from a Web Page that i am displaying on the phone browser to the user. I know that this is possible from an another Android App using Intents. But i am not sure if this is possible from a WebPage.
Thanks in advance.
Intent filters with the BROWSABLE category will let you launch an application using a URI scheme. Inside your <activity>, add:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="myprotocol" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
and set up the action and categories how you want, and change the scheme to something relevant to your application.
Then inside your webpage, you can link to your application with
test link
Simply define a intent filter for a particular URI within your Activity:
http://developer.android.com/guide/topics/manifest/data-element.html
That way, that activity will be called when a corresponding link is clicked. By using a custom scheme you'll make sure that your app is the only one responding.
It's the same way the android market responds to market links.