Android Question PayGate by DonManfred Service Intent Must Be Explicit

Pokmot

Member
Licensed User
Longtime User
Previous thread: https://www.b4x.com/android/forum/threads/paygate-by-donmanfred-event-question.89144/

We are a big step forward. First, I got it wrong about being an IDTECH Shuttle. The device just says "MAGTEK", that's all. It's actually the "IPS" device.


The permissions were set correctly, and having the "res" folder seemed to make a difference.

The error message is now


The most relevant thread I can find is https://www.b4x.com/android/forum/threads/dealing-with-intents-and-broadcast-receiver.44465/ - but "BroadCastReceiver" is an unknown object.
 

Pokmot

Member
Licensed User
Longtime User
Aha, yes it did.

My next message is "java.lang.IllegalArgumentException: method lstw.swiper.main._swipe_ondeviceconnected argument 1 has type java.lang.String, got com.SafeWebServices.PaymentGateway.PGSwipeIPS" for:
B4X:
Sub swipe_onDeviceConnected(Device As String)

When removing the "As String" I get the following text in my label: "com.SafeWebServices.PaymentGateway.PGSwipeIPS@2b92fdd"

swipe_onDeviceDisconnected is triggered.
swipe_onDeviceConnected is triggered.
swipe_onDeviceReadyForSwipe is triggered.

swipe_onSwipedCard is NOT triggered.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Looks like we need to use the Broadcast receiver lib to listen for the broadcasts.
I can not find anything in the SwipeExample project about a Intentfilter or an Broadcast receiver...

Maybe it is important that the example exends the Activity... Don´t know.
The example starts with this line:
B4X:
public class MainActivity extends Activity implements SwipeListener {
 
Upvote 0

Pokmot

Member
Licensed User
Longtime User
Great. It seems we don't need Broadcast; after changing the version to 14 the device unplugging and plugging in is detected and seems to work fine.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
swipe_onDeviceConnected is triggered.
swipe_onDeviceReadyForSwipe is triggered.

swipe_onSwipedCard is NOT triggered.
have you tried to call
B4X:
controller.keepAlive
in one of the events? I guess, maybe the readyforswipe

the method keepAlive
B4X:
  public void keepAlive() {
      this.swipeController.getDevice().requestSwipe();
  }
will request a swipe.

From principle i would say it works as it is one listener for all the events and the other events are raised.
But i don´t know why this event does not raise.

You also can try to call the methods onClick*(view) manually to see if that does anything useful
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…