Android Question SumUp lib seems not to work anymore

udg

Expert
Licensed User
Longtime User
Hi all,
I'm using an old but very good library (NeveGiveUp2's one) to accept payments through a SumUp Air device.
Suddenly it looks broken when using a tablet updated to Android 12.
Please read the original post here.

Did you experience anything similar? Any hint? TIA
 
Solution
My guess is that the SumUp app cannot find your activity because it does not have permission to query the installed packages in its manifest.

Star-Dust

Expert
Licensed User
Longtime User
I have never used this library.

A suggestion that I can give you if you haven't already tried is to see the unfiltered logs, maybe you will see an error message that does not appear on the logs that will allow you to understand the problem.
I hope it will be useful to you
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Android 11 onwards now restricts apps from seeing what other apps are installed without a specific permission try adding this to your manifest

AddManifestText(<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>)
 
Upvote 1

agraham

Expert
Licensed User
Longtime User
If you want to use it in a store app Google will probably not like it

In this case if you only want a specific app you could try
AddManifestText(
<queries>
<package android:name="com.example.something" />
</queries>)

 
Upvote 0

udg

Expert
Licensed User
Longtime User
Thank you both.
Luckily it won't go to the Google Store so one problem less to look at.

I tried the Manifest hint and it somehow worked. Now my app opens SumUp's app.
The lib was intened to "make use" of the SumUp app without showing it.
Anyway, a new errror is now showing (which is probably the cause of the SU's app showing): Activity not found for action <myapp>.paymentresult

I double (and triple) checked the Manifes and the code for spelling errors but found none. Obviously the requested activity is part of the project (which is a B4xPages project anyway).

Strange thing is that everything worked until the OS update.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
The lib was intened to "make use" of the SumUp app without showing it.
How? I've looked in the library and it has a SumUpPay method that I assume you call and this in turn seems to actually open the SumUp app. You seem to need to pass a paymentResultActivity parameter to SumUpPay that I guess is called with the result of the attempted payment and it is probably that which cannot be found. Check your app and manifest against the SumUp example project.
 
Last edited:
Upvote 0

udg

Expert
Licensed User
Longtime User
Thank you @agraham for your support.
Please find below a copy of the whole Manifest. Can you spot any obvious error?
AddManifestText(
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.

'************ Google Play Services Base ************
AddApplicationText(
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:exported="false"/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@Integer/google_play_services_version" />
)
'************ Google Play Services Base (end) ************

AddManifestText(<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>)

'*********************** SumUp-API ***********************
' First you have to ad these intent-filter
AddActivityText(paymentresult, <intent-filter>
<action android:name=".paymentresult"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
</intent-filter>)
' After that you have to replace the short-name .paymentresult with the package-namen and short-name.
AddReplacement (.paymentresult, eu.dgc.vpos.paymentresult)
' You can use another name for the result-activity, but you have to change it in your starting
' Sub and here in the manifest-editor. Good luck!
'******************** SumUp-API (end) *********************

eu.dgc.vpos is my app's name as written in Build and in code where required (responseActivity = "eu.dgc.vpos.paymentresult")

I even lowercased Activity PaymentResult so everything looks identical.

After a Project Clean and using a second tablet (same model, same OS version) when I confirm that I want to pay by SumUp, I read the missing activity message but SU app doesn't open anymore

I can confirm your findings. This is how the lib's SumUpPay is called:
B4X:
' initialize the information and start the payment process
    SU.Initialize
    SU.SumUpPay(affKey, productTitle ,amountStringValue,currency,emailaddress,smsnumber, additionalInfo,responseActivity)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I even lowercased Activity PaymentResult so everything looks identical.
the activityname is paymentresult or did you just lowercased it in the manifest?
 
Upvote 0

udg

Expert
Licensed User
Longtime User
I just reinstalled SumUp's app from the Store. Version 3.7
Now it is shown again when I click on my "Pay with SU" button which calls the lib's functions.
But the message about the "activity not found" is still there.

BTW, I tried to lower targetSdkVersion to 28 but nothing.

@DonManfred
I lowercased it as its filename, removed and added again to the project.
So it is always lowercased now (file system, project, manifest)

I begin to fear that post #8 above is the cause. Anyone have handy 5 tablets based on an old version of Android (updates disabled) ready for next Saturday morning?
I've been told they expect 3000 people at the coming event...:eek:
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
BTW, I tried to lower targetSdkVersion to 28 but nothing.
The problem is with using the SumUp app from outside. I downloaded it and it is targeting SDK31 and doesn't have any queries permissions. My hypothesis, as I am at the limits of my knowledge here, is that the SumUp app can't find the activity you pass to it because of the lack of these permissions. So while it will work as a main payment app it can't be used in the way you are using on Android 11 and later. This is probably a question for the app developers as I have no idea what is going on in that app when it invokes your result activity.
 
  • Like
Reactions: udg
Upvote 0

udg

Expert
Licensed User
Longtime User
Thank you. I saw it but I can't integrate it in one day under all the pressure I'm feeling these days..
Anyway, it looks the way to go now that we understand that the old method should be discontinued.

Luckily for next Saturday I have a B-plan: a couple of 3G Readers for those needing SumUp and the Twint payment for others (yes, cash is accepted too..hehe)
 
Upvote 0

udg

Expert
Licensed User
Longtime User
A quick update
Last Saturday event was a success. Read here the official press release (it's in Italian language, sorry). About 14000 visitors in the day (no, not everybody knocked our door for a meal..hehe) and very good feedback for our service (which includes my VPOS system..)

As for the SumUp's app problem duscussed above, probably we have a solution by @PhiloSophical . Please have a look at his post at the lib's thread.
 
Upvote 0
Top