Comments (10)
I can reproduce this by rebooting the emulator as step 3 (for context, I don't know how you define "Quit Catima" here. IIRC a "force stop" is not a reliable test as that causes Android to block delivery of some intents).
Interestingly, this works fine on Android 13, it broke in Android 14. And long-pressing the card in device controls shows it fine, just short pressing doesn't do anything.
Looking at logcat, I do see a message stating "Background activity launch blocked":
2024-05-11 10:36:38.687 558-2278 ActivityTaskManager system_server W Background activity launch blocked [callingPackage: me.hackerchick.catima.debug; callingUid: 10190; appSwitchState: 2; callingUidHasAnyVisibleWindow: false; callingUidProcState: BOUND_FOREGROUND_SERVICE; isCallingUidPersistentSystemProcess: false; balAllowedByPiSender: BackgroundStartPrivileges[allowsBackgroundActivityStarts=false, allowsBackgroundForegroundServiceStarts=true, originatingToken=null]; realCallingPackage: me.hackerchick.catima.debug; realCallingUid: 10190; realCallingUidHasAnyVisibleWindow: false; realCallingUidProcState: BOUND_FOREGROUND_SERVICE; isRealCallingUidPersistentSystemProcess: false; originatingPendingIntent: null; backgroundStartPrivileges: BackgroundStartPrivileges[allowsBackgroundActivityStarts=false, allowsBackgroundForegroundServiceStarts=false, originatingToken=null]; intent: Intent { flg=0x10000000 cmp=me.hackerchick.catima.debug/protect.card_locker.LoyaltyCardViewActivity (has extras) }; callerApp: ProcessRecord{afd8460 3979:me.hackerchick.catima.debug/u0a190}; inVisibleTask: false]
2024-05-11 10:36:38.688 558-2278 ActivityTaskManager system_server E Abort background activity starts from 10190
2024-05-11 10:36:38.688 558-2278 ActivityTaskManager system_server I START u0 {flg=0x10000000 cmp=me.hackerchick.catima.debug/protect.card_locker.LoyaltyCardViewActivity (has extras)} with LAUNCH_MULTIPLE from uid 10190 (BAL_BLOCK) result code=102
from android.
It's quite hard to find documentation on this. My first idea was to just guard the code on Android 14 with a Toast to explain to users to long-press (not perfect, but an okay workaround for now):
@Override
public void performControlAction(@NonNull String controlId, @NonNull ControlAction action, @NonNull Consumer<Integer> consumer) {
consumer.accept(ControlAction.RESPONSE_OK);
// Android 14 doesn't allow us to start an activity from the background anymore
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
Toast.makeText(this, R.string.long_press_to_show_card, Toast.LENGTH_LONG).show();
} else {
Intent openIntent = new Intent(this, LoyaltyCardViewActivity.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra("id", controlIdToCardId(controlId));
startActivity(openIntent);
closePowerScreenOnAndroid11();
}
}
But of course, Google has another fun surprise up their sleeve: Suppressing toast from package by user request.
(Sure, "by user request"...)
Seems that even telling an user from the background that they need to long-press requires Catima to ask for notification permission even though I currently don't have any other need to ask for notification permissions and this will not make sense to users. 😞
from android.
However, long pressing still won't bring up catima from the lock screen 😔
from android.
It seems a bit buggy just after boot but aside from that I can't reproduce that:
Screen_recording_20240511_112906.mp4
from android.
Seems to be relevant to https://developer.android.com/about/versions/14/behavior-changes-14#safer-intents
But the activity is exported 🤔
from android.
Maybe this https://developer.android.com/guide/components/activities/background-starts#exceptions
Note: Starting from Android 14, apps targeting Android 14 or higher must opt in to allow background activity launch when sending a PendingIntent. To opt in, the app should pass an ActivityOptions bundle with setPendingIntentBackgroundActivityStartMode (ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED)
If that's the case, there's a bug in Android...
from android.
I found out today that apparently Samsung's Android skin ("One UI") doesn't have any effect on long-pressing an entry, just moving it around. Given this extra limitation on Samsung devices making the only workaround I could think of not universally possible I think the only logical option that remains is disabling this functionality on Android 14+.
It sucks for those who do prefer to open cards this way but well, our hands seem tied here...
from android.
On the other hand, I'm curious how it works for the google home app 🤔
from android.
I don't think Google will let us take a peek into the kitchen :P But it may be worth looking at the Home Assistant Android app, see if the same issues exist there and if not how they do it.
from android.
I can confirm that single tap work for Google Home
from android.
Related Issues (20)
- Highlight archived cards HOT 2
- Display loyalty cards as a text list, without thumbnails HOT 3
- Hide Card ID for binary content? HOT 2
- Loyalty card shortcut not updating with latest card information HOT 2
- About screen text can overflow into arrow HOT 1
- Proposal to Enhance Testing Infrastructure and Automate Workflows HOT 1
- Incorrect Implementation of describeContents() in LoyaltyCard Class HOT 3
- Google Play: "Can't install Catima (2.29.0)" HOT 3
- Errors in Spanish Translation HOT 1
- Cannot save balance in Arabic
- Option to disable the edit button on the lock screen HOT 3
- FR: Share text to app instead of image HOT 4
- Shortcut in control panel HOT 1
- Add an attached document (PDF) HOT 8
- can android.hardware.camera use required=false? HOT 2
- Barcode scanner error unreadable on Samsung in light mode
- Front of Card Image not the default HOT 4
- Width of Barcode Display HOT 4
- GUI feature/accessibility request: different number of columns HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android.