Android Responder A URL en Intent
Quiero que mi intent se inicie cuando el usuario vaya a una determinada url: por ejemplo, Android market hace esto con http://market.android.com / urls. también Youtube. Quiero que el mío también haga eso.
148
Author: Rahul Tiwari, 2009-02-08
2 answers
¡Lo hice! Usando <intent-filter>
. Ponga lo siguiente en su archivo de manifiesto:
<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.youtube.com" android:scheme="http" />
</intent-filter>
Esto funciona perfectamente!
186
Author: Isaac Waller,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-10 03:28:09
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-10 03:28:09
Es posible que deba agregar diferentes permutaciones a su filtro de intents para que funcione en diferentes casos (http/ https/ ect).
Por ejemplo, tuve que hacer lo siguiente para una aplicación que se abriría cuando el usuario abriera un enlace a Google drive forms, www.docs.google.com/forms
Tenga en cuenta que el prefijo de ruta es opcional.
<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="docs.google.com"
android:pathPrefix="/forms"/>
<data
android:scheme="http"
android:host="www.docs.google.com"
android:pathPrefix="/forms" />
<data
android:scheme="https"
android:host="www.docs.google.com"
android:pathPrefix="/forms" />
<data
android:scheme="https"
android:host="docs.google.com"
android:pathPrefix="/forms" />
</intent-filter>
7
Author: Jordan Réjaud,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-09 21:26:25
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-09 21:26:25