mercredi 27 mai 2015

How to connect an intent to a function

I don't see how to specify the function that an intent filter calls or how to get the arguments (data) from that intent.

For instance, say in my AndroidManifest.xml file I have the following:

<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="example.com" android:scheme="http"></data>
</intent-filter>

A user goes to http://ift.tt/1HMV2Mh - an app-chooser pops up and the user chooses my app (let's call it MyApp). So what gets called within MyApp and how do I get the arguments, in this case /some-end-point that was called?

How do I specify what block of code this intent refers to ... Do I register it within the Java code or do I specify it in the XML?

Sorry for the basic question but I've been unable to find this after quite literally days of searching and going through the sample code.

Aucun commentaire:

Enregistrer un commentaire