Android onTrimMemory testing - android

How can I simulate TRIM_MEMORY_RUNNING_LOW in Genymotion or on a real device? Can I send a command from Android Studio or per command line (with adb)?
I really need to test it, while my app is in front and not in background.

Related

How to run flutter app on a real device without having to install the sdk on your phone evrytime

I use my mobile device to run my flutter applications. I know all about the hot reload but I'm so tired of having to wait every time I connect back to my phone again maybe the next day and then the app has to be re installed and the gradle task assembler has to be built again. Please I want to ask if there is a way to reconnect easily and a way for the apps to run easily again any time I want to work on a project again after a while.
There are a couple of alternatives to building the APK and installing it on a physical device:
Use an emulated android device
You can use an android emulator. The easiest way to set that up is probably the graphical interface in Android Studio (see https://developer.android.com/studio/run/managing-avds), but you can also use flutter emulators --create [--name <Name>] to create a new virtual device. Then use the button in the bottom right of VS Code to select that device, before launching the debugger.
Build for desktop
Depending on the dependencies of your app, you could try building the app for the platform you're developing on (Windows, Linux, or macOS). This has the same visual result as an Android app, but does not need an emulator or physical device. The rendering engine is the same (Skia) on all platforms. The obvious downside is that some plugins may not be available for desktop.
See https://docs.flutter.dev/development/platform-integration/desktop on how to set that up.

Android Studio / Kotlin: cannot run app on an physical device ("Couldn't terminate the existing process for...")

I am new to Kotlin, and currently building my very first app (I am not experienced at all on the topic).
I successfully managed to customize my android phone and my android studio and achieved to launch the app I am currently working on a few times.
However, I now run into an error when trying to launch my app on my physical device. I get the following message: "Couldn't terminate the existing process for com.example.diceroller.", as if it was still running. The icons to launch/stop the app also seem to be in a state where the app is running on the device.
I have tried the following, without result:
close all running apps on the phone
reboot the phone
restart Android Studio
deactivate/reactivate USB debugging on the phone
The app does work fine on a virtual device.
Could you please give me any lead to follow to try and be able to test my app on a physical device? Thanks a lot!
Try to kill the daemon, open your terminal and write this
adb kill-server

How to run Android emulator on network with Android Studio?

I've been debugging apps with built in android emulator which comes with Android Studio and It almost takes 10 mins to build the project since I have quite a low-end PC.
So I figured It would be easy If I could run emulator on different PC than Android Studio's, And somehow share their connection with network sharing. (Is it even possible?)
For instance: I have two PCs (Lets say A and B) on same network, both being potato PCs could manage to run android emulators without any additional load on system resources.
So what I want is to make PC-A run emulator and PC-B run Android Studio and by clicking on run, the app loads into the PC-A's emulator and I could see logs etc in PC-B's Android Studio.
I know I could build an apk and run it on different PC but I want to run it with debugging as well i.e LogCat etc.
Also, I don't want to use my real android device for testing purposes.
PS: I would gladly accept any alternatives etc.
Thankyou.

Can I call Android LockScreen function from Linux command line?

Running Android 4.0.4 on Emerson EM543 Tablet. Could not install Google Play so had to install Android Market. Market apparently somehow disables the Android system LockScreen. So, now trying to get lockscreen back on boot (downloadable apps, as far as I can see, don't lock screen at system boot, which is what I want). I got a terminal emulator and was wondering if there was a Linux command line argument I could use to start Droid lockscreen at system startup. Any suggestions?
All the questions and solutions I have found regarding "lockscreen" deal with programmatic solutions. I am looking for a command line argument that could be used in a startup script.
Programmatically in android code, you can use Device Admin API's to lock screen, Refer http://developer.android.com/guide/topics/admin/device-admin.html
devicepolicymanager.lockNow();

Android test application directly on device

is there a way to compile an apk and test it directly in an usb-attached device ? The emulator is way too slow for a fluid development.
Using eclipse, make sure the project is debuggable, software for the phone is installed on the computer. Set the phone to accept unknown recourses. First connect the phone, then start eclipse (sometimes the other way round results in the phone not being found) If you try to run the application eclipse should prompt you asking witch device to use. Click your phone and presto!

Categories

Resources