Why do toasts get truncated when app is installed on Android 12 APi 31 - android-toast

The documentation says that Toasts are truncated to two lines on applications targeting Android 12 or later. The behaviour that I observe is that Toasts are truncated to two lines on applications installed on a device running Android 12 or later.
Specifically, one of my apps which was installed before my phone was updated to Android 12 does not get its toasts truncated, but if I install it on the emulator running Android 12 it gets its toasts truncated. Another app which I rebuilt and installed after my phone was updated to Android 12 gets its toasts truncated.
[added] The situation appears actually to be more complicated: the behaviour also depends on the device and apparently also on whether it's a debug or a release build. The same app which was getting its toasts truncated displays them correctly with a release build on my phone, but truncates them with the same release build on the emulator.
Note that this is not the same question as 70307699 where the OP updated his targetSdk to 31. Both my apps have targetSdk set to less than 31.
How can I get the documented behaviour and get my toasts back?

Rather than outright deprecating toasts, the Android Platform Team is instead making them progressively less useful, which is a form of deprecation.
https://developer.android.com/reference/android/widget/Toast
The last sentence states: Starting with Android 12 (API level 31), apps targeting Android 12 or newer will have their toasts limited to two lines.
Going forward I'll personally be using Snackbars if I need a multi-line message.
val SNACKBAR_MAX_LINES = 8 // Increase maximum SnackBar line limit above 2
val snackbar = Snackbar.make(bottomNavigationView, "message", Snackbar.LENGTH_SHORT)
(snackbar.view.findViewById(com.google.android.material.R.id.snackbar_text) as TextView)
.run {
maxLines = SNACKBAR_MAX_LINES
}
snackbar.show()

Related

PixelCopy returns outdated data on Android 10

I get screenshots on Android 10 using Pixelcopy.
I faced with a situation that when switching fragments via supportFragmentManager.beginTransaction().replace, an outdated screenshot is regularly returned.
In fact, a new screen has already appeared - PixelCopy was called after onResume's work on the new fragment, but the screenshot shows the image from the previous fragment.
Perhaps this is somehow related to a weak device (2 GB of RAM) Xiaomi Redmi 9a
Has anyone faced with this situation? Is there a way to eliminate this error maybe?

Empty Firemonkey app crashes on startup just on Android 7.1, with error NullPointerException on String.contains(CharSequence)

I created a completely new and empty FMX app, tried it using Delphi 10.3.3 and 10.4.0 (patch 3), and when installed on Android 7.1.2 devices (tried two different ones and the official simulator VM), after the splash screen this error message appears:
'java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference'
The error message box flickers quickly (endless loop) and gets slower and slower and after a minute the complete device doesn't react anymore and I can only hard reset it.
I found this thread, so I'm not alone. They say it worked until Delphi 10.1.2. There are also many other similar search results.
Is there any solution? On other Android versions it works well.
Or what can I try to get more information about what causes it?
Do you know a good candidate for an app made with Firemonkey that I could download directly and try out on the device?
Now there is a fix available at quality.embarcadero.com!
Just one line has to be added to 'Androidapi.JNIBridge.pas'. I'm not sure if I should copy it here... Will update this answer when it is released.

Worklight persistent busy indicator

I'm working on a project using IBM Worklight and any time I build and deploy my project on any simulator or device, I have this busy indicator spinner in the middle of the screen. Its always there, on every page and its there in the ios, windows, web and android simulators as well as one android device we've tested on. Has anyone seen this before and if so how would I get rid of it.
Jquery-mobile was the problem, it was continuously displaying the indicator for seemingly no good reason. Deleting Jquery mobile fixed the problem
I already used the native worklight loading.It is very good and I tested it on different platforms, devices. But it is necessary to close it when you leave the function that opened it.
Example:
var busyInd = new WL.BusyIndicator ("content", {text: "Please wait..."});
function consult(){
busyInd.show();
//impl
busyInd.hide();
}

IBM Worklight 5.0.6.1 - Bottom white space in iOS 7

As you can see, at the bottom of my page remains a white space.
Its height is the same of the old status bar that was present in ios6.
Do i have to modify css? Because I never fixed an height for my app, worklight has always chosen the right size.
EDIT: you have to save the image and open in a desktop with different color to see the white space at the bottom.
*
* Licensed Materials - Property of IBM
* 5725-G92 (C) Copyright IBM Corp. 2011, 2013. All Rights Reserved.
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
// This method is invoked after loading the main HTML and successful initialization of the Worklight runtime.
function wlEnvInit(){
wlCommonInit();
// Environment initialization code goes here
}
//Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
alert(device.version);
if(device.version > "6.0")
$(".elmecHeader").css("height", "70px");
}
Worklight 6.0.0.1 was just released over the weekend; it addresses the status bar issue depicted in your screen shot.
The fix for 5.0.6.1 is not publically available (it is for customers who use this version and require it).
Update:
The white spacing at the bottom was a Worklight bug and is fixed in the latest 6.0.0.1 iFix as well as available for Worklight 6.0.0.x and Worklight 5.0.x for customers from IBM Fix Centeral.
Yes, you will need to adjust your application for iOS 7.
You can use Cordova Device API to detect the OS that the app is running on and use different CSS for the different OS layout in iOS 6 and 7 (if you wish so).
I suggest to add more of the green background at the top, so that the new status bar in iOS 7 will not overlap with your app design.
This is a problem all web-based apps will suffer from in iOS until a proper solution is devised.
Be sure to also read the Apple-provided iOS 7 Transition Guide.
The above is one suggested approach; you should probably read more material about iOS 7 design and about how the status bar behaves in iOS 7 and choose the right path for your app.
http://ivomynttinen.com/blog/the-ios-7-design-cheat-sheet/
http://www.slideshare.net/evgenybelyaev16/transition-guide
As for the bottom spacing, this is a bug in Worklight.
Worklight was updated since you posted your question.
Download the latest version of fixpacks, and make sure to read the tech note entirely: http://www-01.ibm.com/support/docview.wss?uid=swg27039574

Missing icon in Windows 8 store

I've recently uploaded my first Windows 8 Store application (hurray!)
http://apps.microsoft.com/webpdp/app/doctor-pepper-tattoo/03ed51ee-c1a4-4fb5-b388-76a2ccf10061
The only problem is that although I have specified a valid Small logo (30x30) in app manifest, it does not appear in the Windows Store. This is the file (I hope it was not converted by TinyPic)
http://i50.tinypic.com/35k9b20.png
What could be the problem? Perhaps an unsupported PNG variant? I notice that there a quite a few other apps in the Store with a missing icon (urbaneous, Volksvagen Commerial Vehicles Turkey, etc) so they could be facing a similar issue.
Thanks,
Themos
Since you specified the file in app manifest it should appear when you install the application. If you had submitted the app while submission then it should have appeared on the marketplace. I do't know about the Windows 8 app procedure but since it should not much different from that of windows 7, this is only what I could comprehend. Please install and check the icons. I also hope that icon will be used when a user minimizes your tile to the smallest size on the start screen.
Did you specify the Store Logo in apppackage?
Go here so you can read more about app images.
This is most likely an error on Microsoft's part. You have to make a post on:
http://social.msdn.microsoft.com/Forums/en-US/windowsstore/threads
Or wait until MS updates their backend. There is no such thing as an unsupported png, and it can be a number of issues.
This will most likely be fixed before the actual MS Windows 8 release.