question

Danielle Cox avatar image
Danielle Cox asked Danielle Cox commented

Read order from a receiver

I have a receiver on ACTIONPAYMENTPROCESSED working, but if I try to connect to an OrderConnecter to look at the order and it fails saying Caused by: android.content.ReceiverCallNotAllowedException: BroadcastReceiver components are not allowed to bind to services

So, I have created an activity to be a "dispatcher" (check order and call "real" activity if one of our inventory items is in a fullly paid order). I have added the style via the manifest <activity android:name="com.realmobiletech.rmtclover.RPDispatcher" android:label="RPDispatcher" android:theme="@android:style/Theme.NoDisplay" android:screenorientation="landscape" android:configchanges="orientation|keyboardHidden" &gt;="" <="" activity="">


My problem is that I get a flash when the activity is started even if I kill it immediately. This flash is very brief but also noticeable. If I just make the receiver go away, there is no flash. So I guess my two questions are 1) am I on the right track to solve the problem of performing an action if my inventory item is paid for with the above solution (receiver listening to ACTIONPAYMENTPROCESSED and then searching the order to determine if I start an activity to deal with it 2) how do I check out an order at that point without causing a flash on the screen?

Thanks!

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered Danielle Cox commented

Standard Android pattern for this is to have the receiver start a service to perform the work. You have right idea, just use a service and not an activity.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Danielle Cox avatar image Danielle Cox commented ·

Thank you!!

0 Likes 0 ·

Welcome to the
Clover Developer Community