-1

I would like to make a link in Android browser to be able to call a receiver.

I read this post on how to make a link start my app and tries to do the same for my startup receiver receiver, but it didn't work. Is it possible?

My receiver is configured as follows:

        <receiver
        android:name="com.wiziapp.wiziappweb.app.MyStartupIntentReceiver"
        android:label="@string/search" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />

            <category android:name="android.intent.category.HOME" />
        </intent-filter>
        <intent-filter>
            <data android:scheme="myapp" />

            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </receiver>

The link I use to test it is:

<a href=myapp://enable_notification">Enable notification</a>
Community
  • 1
  • 1
Asaf Pinhassi
  • 14,214
  • 11
  • 102
  • 121

1 Answers1

1

I would like to make a link in Android browser to be able to call a receiver.

That is not possible.

My receiver is configured as follows:

ACTION_VIEW is used with startActivity(), not sendBroadcast(), so your second <intent-filter> is unlikely to ever be used.

The link I use to test it is

Links only call startActivity(), not sendBroadcast(). Your are welcome to have the link point to a Theme.NoDisplay activity that sends the broadcast and then calls finish() to go away.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253