android intent { (has extras) },Error receiving broadcast Intent { act=android.intent.action.HEADSET...

Description

I am not so sure if this is a bug with React Native, or I am doing something wrong. I am creating a point of sale app. I have bridged a native android library to react native that allows the app to connect to a magnetic card reader peripheral, and read card details into the app from it via the device's headphone jack. There is a bug that causes the app to automatically close if the magnetic card swipe peripheral is not connected when the app is started. the error code I get back is this:

java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.HEADSET_PLUG flg=0x40000010 (has extras) } in com.imagpay.bP@35df2f9

at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:972)

at android.os.Handler.handleCallback(Handler.java:743)

at android.os.Handler.dispatchMessage(Handler.java:95)

at android.os.Looper.loop(Looper.java:150)

at android.app.ActivityThread.main(ActivityThread.java:5621)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)

Caused by: java.lang.NullPointerException: Attempt to read from field 'boolean com.imagpay.bN.i' on a null object reference

When i use the same library in a purely native android app, it works properly and does not close if the peripheral is not connected. Is there something I am missing in react native or is this a bug with react native? I have posted several times on stackoverflow and no one seems to know what to do.

Reproduction

Links to my code are here:

thats the code for the entire app. the faulty code is at:

in react native and:

is where the java module is implemented

[FILL THIS OUT: Try to reproduce your bug on rnplay.org and provide a link. If you can't reproduce the bug on rnplay.org, provide a sample project.]

Solution

????

Additional Information

React Native version: 0.39.0

Platform: Android

Operating System: MacOS X Sierra

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值