Is it possible to create an intent filter at runtime to receive
intents which are directed at certain websites?

I created the basic hello world project in Eclipse and added this to
AndroidManifest.xml, and it worked (a choice was given between the
browser and this app):
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" /
>
                <data android:host="www.terribleinformation.org" />
                <data android:scheme="http" />
            </intent-filter>

However, if I add this code to the main activity instead, it doesn't
work:
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_VIEW);
        filter.addCategory(Intent.CATEGORY_DEFAULT);
        filter.addDataAuthority("www.terribleinformation.org", null);
        filter.addDataScheme("http");

        registerReceiver(new BroadcastReceiver() {

                        @Override
                        public void onReceive(Context context, Intent intent) {
                                Log.v("IntentFilterActivity", "Intent 
received!");

                        }
                }, filter);
    }

Any suggestions?
-George

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to