Invoke an Android App from a WebPage - android

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.

Related

How to use web app to share content in mobile?

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

Run Application via link

I am working on an application where i have to create a link of my application and copy that link to text buffer and paste that link in my device in any text editor. Now when i tap on that link my application should open and show appropriate data. I don't know how to implement this i searched on internet I did not find any solution which can explain this feature implementation. give me the best way to implement this.
I have tried this but can not understand
Launch your application when a link taped
You have to use other app to start it. You should register intent-filter with other action and category in your app. The most common action should be ACTION_VIEW combine with category BROWSABLE, then you can use a url in brower or sms to open you app. The intent-filter should be like:
<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="openmyapp"
android:scheme="http" />
</intent-filter>

Launcing Applications with Custom URI on Android

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..

How to integrate my gallery app in with the default gallery in android

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>

How to set android application "type"?

Is there a way to set your applications "type"? For example, If I download Opera for Android and then in another application I click a web URL, Android will ask me do I want to open the link with the default browser or with Opera. How do Opera achieve this?
EDIT specifically, how would I pass the URL into my activity?
You should read about activities and intent-filters.
Here is a good starting point: Activities, and specifically Intent Filters section.
This is done via the mechanism of Itent filters, that are defined in your Manifest.xml.
I think Opera has probably an intent filter like this set on the main activity :
<intent-filter>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<action android:name="android.intent.action.VIEW"/>
<data android:scheme="http"/>
</intent-filter>
Then when the opening of a web page is requested via a sent Intent, the system will search through its database, which application can answer it and propose the applications to the user.
I think you have to study intent-filters. Here is the short text from android docs.
"Components advertise their capabilities — the kinds of intents they can respond to — through intent filters. Since the Android system must learn which intents a component can handle before it launches the component, intent filters are specified in the manifest as elements. A component may have any number of filters, each one describing a different capability."
Specifically for a browser I suppose that you have to register it like below:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>

Categories

Resources