• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

App Inventor Cannot invoke observer on a background thread

hi all, I'm implementing a REST Full WebService API which has only one GET method.
Inside this method I created an observer to read the <LiveData> returned by a function, but when I try to read it gives me an error: cannot invoke observe on a background thread
Here my code:

@AndroidEntryPoint
class MainActivity : AppCompatActivity()
{
private lateinit var verViewModel: VerificationViewModel
private lateinit var qrCodeText: String
var certStatus: String = "vuoto"


override fun onCreate(savedInstanceState: Bundle?)
{
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)


verViewModel = ViewModelProvider(this)[VerificationViewModel::class.java]

embeddedServer(Netty, 8000)
{
install(StatusPages) {
exception<Throwable> { e ->
call.respondText(e.localizedMessage, ContentType.Text.Plain, HttpStatusCode.InternalServerError)
}
}


install(ContentNegotiation)
{
gson {}
}


routing{
get("/getStatus/{qrText}") {
certStatus ="vuoto"
qrCodeText = CastNullableString(call.parameters["qrText"])
certStatus = validateGreenPass(qrCodeText)
call.respond(Response(status = certStatus))
}
}
}.start(wait=true)
}


data class Response (val status: String)

fun CastNullableString(str:String?):String
{
if (str == null)
{
return ""
}
else
{
return str
}
}


private fun validateGreenPass(qrCodeText: String):String
{
var status:String = "Vuoto"
try
{
val certObserver = Observer<CertificateSimple?> {
fun onChanged(@nullable personModel: SimplePersonModel,@nullable date:String,certificateStatus:CertificateStatus,@nullable time: Date){
status = certificateStatus.toString()
}
}
verViewModel.certificate.observe(this,certObserver)
(when execute this give me error)
verViewModel.decode(qrCodeText, false);
}
catch (e: Exception)
{
status = "ERROR: " + CastNullableString(e.message)
}
return (status)
}
}

Anyone know how to help me?

Screenshot editor

Sorry to be thick but which app is it ?

Presumably it's this app, and you posted in the forum for it.
https://play.google.com/store/apps/details?id=pl.waskysoft.screenshotassistant

Although quite frankly you shouldn't even need to use a third-party screen-shot editor with this phone, as the S21, Note20, and other recent Samsungs have a good screen-shot editor feature included. Which I'm sometimes using myself to crop and resize my screen-shots.

Copying Apps AND Data AND Settings to New Phone

How do people who change Android phones all the time (reviewers, etc.) copy the old phone apps and settings to the new phones

I suspect professional reviewers will also have their own personal devices they keep for a long time. And are not doing private things like banking or messaging on a device that isn't theirs and may only be looking at and evaluating for a few hours or days.

A32 5G constantly losing network

Keep in mind that there's the marketing version of all the glories that 5G will provide, and there's reality.
Here in the U.S. the implementation for 5G is spotty, very regional, and fractured by corporate indecision (involving different types of 5G protocols) so it all boils down to if you are in one of the limited 5G coverage zones, it's incredible, but when you're not it might be usable or it might not even be available. So just depending on your where you reside can be a factor. Personally I can get by fine with just good 4G connectivity, and just ignore all the 5G nuttiness until things just settle down.

Try creating a new APN entry and see if that makes your cellular connectivity more reliable. Here's a link to T-Mobile's site:
https://www.t-mobile.com/support/devices/not-sold-by-t-mobile/byod-t-mobile-data-and-apn-settings
Usually just installing a new SIM card will trigger your phone to automatically create a new APN entry but sometimes that process doesn't work out. You could just edit an existing APN entry but creating a new one is safer (you can always revert back to the original APN entry if your newly created one is a problem.)
So create a new one following T-Mobile's recommended settings, be sure to use the exact wording, spaces, and capitalization. Select this new APN entry, and be sure to restart your phone so it gets used as the new configuration.

Help Status bar notification symbol meaning

we get this question almost everyday. the problem is that there are millions upon millions of apps each with their own notification icons. so unless it is a popular app, most of these questions go unanswered.

the easiest way to know what it is is to look into the phone's notifications to see what it is. most of the time though, the op does not have access to the phone. but in your case, it is an old screenshot.

sorry but i have not seen those icons before. the picture is really fuzzy so hard to say. the "s" could be anything. look for apps that start with an "s".

Exporting a 64bit Android app that uses TinCan (xAPI)

I'm using the Unity game engine to develop an Android app. It's using the TinCan.NET xAPI library for tracking user activity.

The app already works when built to Android with the "Mono" scripting backend. But when I switch to "IL2CPP" (for the Google Play 64bit requirement), I suddenly have build issues with the TinCan.dll and any script that uses it. It gives me a "
No action for the assembly TinCan, Version=1.3.0.0, Culture=neutral, PublicKeyToken=7e2d97554f738180 defined" Linker error.

This is the best tutorial I've come across. He only uses "Mono", and even in the comments, he acknowledges that it doesn't work on IL2CPP for him and someone calls out the apparent lack of support for IL2CPP/64bit.


tl;dr: Is there a way to build 64bit APK/AAB with TinCan?

The Impossible Text

I received a text from my wife yesterday that read "Great. Thanks." As I hadn't recently done anything worthy of her gratitude I replied "For what?". She then called me from the other room and asked what I meant and I told her I was replying to her text. She said she had not just sent me a text. I said she probably intended it for someone else but she insisted she had not just sent anyone a text. I went and took a look at her phone and, sure enough, there was no text to me, only my "For what?" reply. I scrolled through all her recent texts and there was no "Great. Thanks".

I tried to imagine a scenario where someone could receive a text that doesn't appear on the senders phone or how someone could send a text but have it appear to be from someone else, but I failed. I hate having something stump me like this. Does anyone have any idea how this could happen?

Export your texts to file and check out the metadata.

How to disable only 3G

How does your phone connect to 3G if that has been turned off? If there is no 3G signal it should connect to 2G (if your network is still broadcasting 3G but not offering a service then they are morons!).

Anyway, I don't think you can, or at least it's at your own risk to try. I've looked in the hidden "testing" menu (type *#*#4636#*#* in the dialer and select "phone information") and the only option I can see in the "set preferred network type" that includes 4G (LTE) and 2G (GSM) but not 3G (WCDMA) includes protocols that are only available in China and which I'm not aware that my phone's hardware supports, so I'd be wary of selecting that option in case it also had some other side-effect. If you do decide to try this please make sure you note what the current setting is first, and do not change anything else: this is an engineering menu, not something that is supposed to be touched by the general user, and if you mess up the settings in there you can lose basic telephony features. It's one of the few places on an unrooted phone where it's possible to really mess things up in a way that isn't easy to fix, and I've seen people who didn't take sufficient care with this menu do just that. But it's also the only place in the phone where you can make changes to the network that go beyond what's available in the regular system settings (which on my Pixel offers 4G or 3G, nothing else).

Touching issues with ROG Phone 5

And I don't mind if it's inside as long as it doesn't casue problems.
Well since you are having problems there is a matter of determining just what's causing them. It might be the syrup or something else. If so, keep in mind that smartphones are not designed to work with foreign substances added to their interiors. Stuff that may or may not have conductive properties 'could' be an issue depending on what they're in contact with. Also, all it takes is a small drop of a fluid to make an impact so whether it was actually just 1 ml or 20, even just a minuscule amount will get spread out over a wider amount. Space tolerances inside our phones are very tight and compacted, so basic capillary forces will make a difference.

Can I partition on an external SD card for Android 10 and use it for different purposes?

Are you prepared to root the phone? If so then there may be options, though I've not used them myself for best part of a decade so have no experience of them in Android 10. They won't involve using the system menus to format one partition as internal, but rather add-on apps or scripts to move some of your apps and/or their data to the partition and set up pointers to them in the internal storage (so that the phone knows where to find them).

Without root the answer is simple: no, you can't. The phone software only expects there to be one partition on the card and won't look for a second one. All that will happen if you partition the card is that the phone will only see the first partition, so effectively you will have reduced the capacity of the card. To tell the phone to mount and use the second partition you will need to modify the system software, which means you will need root.

Help Where Can I Download An Official Stock ROM?

You can get it from samsung Official web, but don't forget to check the region....
i have never been able to find any kind of firmware updates for their mobile devices on their website. sammobile has always been the place to go for official samsung mobile firmware updates. do you have a link to updates on their website? i would love to know where you would find them.

Filter

Back
Top Bottom