Quantcast
Channel: Square Developer Forums - Latest topics
Viewing all articles
Browse latest Browse all 1331

Mobile-payment-sdk crashing the Android POS App by detecting Star Usb Printer

$
0
0

Greetings,

Our POS App using your mobile-payment-sdk-2.0.2 version. Everything is working fine except the following Manifest’s code of yours:

<activity
            android:name="com.squareup.usb.UsbAttachedActivity"
            android:enabled="false"
            android:exported="false"
            android:theme="@style/Theme.Translucent" >
            <intent-filter>
                <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
            </intent-filter>

            <meta-data
                android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                android:resource="@xml/usb_device_filter" />
        </activity>

When our app is on foreground and we connects the Star thermal usb printer… then your USB_DEVICE_ATTACHED intent filter called up and it’s crash our application. Following is the Crash Error for your reference:

 FATAL EXCEPTION: main
                 Process: insane.element.foodielandpos, PID: 32698
                 java.lang.NullPointerException: null cannot be cast to non-null type com.squareup.appengine.selection.AppEngineStateReader
                 	at com.squareup.appengine.selection.AppEngineStateReader$Companion.fromSystemService(AppEngineStateReader.kt:28)
                 	at com.squareup.usb.UsbAttachedActivity$onCreate$1.invokeSuspend(UsbAttachedActivity.kt:38)
                 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                 	at kotlinx.coroutines.internal.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuation.kt:363)
                 	at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(Cancellable.kt:26)
                 	at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable$default(Cancellable.kt:21)
                 	at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:88)
                 	at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:123)
                 	at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(Builders.common.kt:52)
                 	at kotlinx.coroutines.BuildersKt.launch(Unknown Source:1)
                 	at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(Builders.common.kt:43)
                 	at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:1)
                 	at com.squareup.usb.UsbAttachedActivity.onCreate(UsbAttachedActivity.kt:37)
                 	at android.app.Activity.performCreate(Activity.java:8995)
                 	at android.app.Activity.performCreate(Activity.java:8964)
                 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
                 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4146)
                 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)

Please provide a fix for this ASAP. thanks!

3 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 1331

Trending Articles