One of the most powerful concepts of Android Development is that you can send asynchronously messages to other activities and services via Intents. The standard case is that you specify the intent you want to call and then Android starts the corresponding activity. You can also register yourself to existing events. For example if you writing an browser application you can register yourself in “AndroidManifest.mf” via the following intent filter as a browser.<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".BrowserActivitiy"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>
</activity>
</application> If you install this application and open an URL in another application you should get a popup asking which application should be opened. As now two application have registered for the same intent the user have to choose which one should be used.
Read more: Developer Papercuts
<activity android:name=".BrowserActivitiy"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http"/>
</intent-filter>
</activity>
</application> If you install this application and open an URL in another application you should get a popup asking which application should be opened. As now two application have registered for the same intent the user have to choose which one should be used.
0 comments:
Post a Comment