Dear all,
I am trying to trigger an Intent when the user clicks on a link.But
the behavior is different when the link is on a web page accessed by
the Android Browser and when received by email (Android Email
application).
My link and intent filter are as follows
<a
href="intent:#Intent;action=com.mycompany.aproject.MYACTION;package=com.mycompany.aproject;end">
click to load</a>
<intent-filter>
<action android:name="com.mycompany.aproject.MYACTION" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
When the user clicks on this link in the Browser everything works
fine:
I/ActivityManager( 61): Starting: Intent
{ act=com.mycompany.aproject.MYACTION
cat=[android.intent.category.BROWSABLE] pkg=com.orange.test
cmp=com.mycompany.aproject/.AnActivity } from pid 332
But when he clicks on the link within an email:
I/ActivityManager( 61): Starting: Intent
{ act=android.intent.action.VIEW
cat=[android.intent.category.BROWSABLE]
dat="intent:#Intent;action=com.mycompany.aproject.MYACTION;package=com.mycompany.aproject;end
flg=0x80000 (has extras) } from pid 295
Instead of my custom action, android.intent.action.VIEW is sent and
the whole uri gets into the data field....
This behavior seems be due to a different implentation of the
"shouldOverrideUrlLoading(WebView view, String url)" method in the
BrowserActivity line 2666
intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
and in MessageView (part of the email app,)
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
Is there any workaround to trigger a custom action with a link in both
applications?
(using a custom android:scheme works in both but does not achieve the
same direct Activity triggering for a custom action)
Is this the normal behavior for the email application? Are there any
standards on how a clickable link triggers an Intent in Android?
Thanks in advance
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en