How to show soft keyboard on Android Things? - adb

I'm trying to show soft keyboard on Android Things, Raspberry Pi 3. I tried the methods below, but not succeeded so far:
<activity
...
android:windowSoftInputMode="stateAlwaysVisible">
and
<EditText
...
android:inputType="numberDecimal"/>
Does Android Things 7.0 support soft keyboard, or am I missing something?

Update II: there is a bug with Dev Preview 5.1 when Google's soft keyboard doesn't show up at all.
Update: starting with Dev Preview 4 the Android Things image is shipped with com.google.android.inputmethod.latin preinstalled. If you're going to use a 3d party keyboard app the approach below is still valid.
You should enable the IME in Android Things Developer Preview in order for it to show up. Let's consider Google Keyboard as an example (since it worked for you). Once the keyboard has been installed and you shell-ed in (with adb shell) the following options might be used:
Command line solution
Find out the IME ID
$ ime list -a | grep mId
Enable the IME using the fully qualified mId
Android Things 0.5+ (you might get already enabled)
$ ime enable com.android.inputmethod.latin/.LatinIME
Android Things 0.1 - 0.4:
$ ime enable com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME
Note: If you'd like to use the IME "app-wide" (not "system-wide"), use ime set ID instead of ime enable ID.
Settings app solution
Android Things 0.5+:
am start -n com.android.settings/.Settings\$SystemDashboardActivity
Languages & Input -> Virtual keyboard -> Manage keyboards and enable the IME (should already be enabled)
Android Things 0.1 - 0.4:
am start -n com.android.settings/.Settings\$InputMethodAndLanguageSettingsActivity
Virtual keyboard -> Manage keyboards and enable the IME
Note: In order to close _Android_'s settings app from within shell you can emulate a back button press multiple times with input keyevent 4 or force close the app with am force-stop com.android.settings.

By default, keybord apps are not installed on AT Developer Preview. You have to install it. See software keyboard.

Related

How to test the ram memory usage in react native?

I am very new on react native, I am trying to know how to see the memory usage that my app need when I developing, and some tricks to improve this.
If you are here in 2022. Use this:
Android Profiler: https://developer.android.com/studio/profile/android-profiler
Android Device Monitor was deprecated since Android Studio 3.1.
More info here: https://developer.android.com/studio/profile/monitor
For Android, I hope this helps
adb shell dumpsys meminfo
But this is not human friendly, very difficult to understand.
You can also try.
Android Device Monitor, if you have Android Studio, you already have it. Open it up with these steps:
Run React Native app normally (react-native run-android)
Run Android Studio
On the menu, click Tools → Android → Enable ADB Integration
Click Tools → Android → Android Device Monitor
When Android Device Monitor shows up, click Monitor → Preferences
On the dialog, in Android → DDMS, check these two options:
Heap updates enabled by default
Thread updates enable by default (optional)
Then you will see a pie-chart type data in System Information tab.
In order check Heap allocation and/or usage, select your app on the Devices tab on the left.
Reference
https://shift.infinite.red/react-native-android-app-memory-investigation-55695625da9c

Is it possible to copy/paste/type (eg. a password) from an app into the Oculus Quest headset?

Currently there doesn't seem to be an easy way to copy/paste text in the Oculus Quest, nor to 'type' into a companion app and have it sent into the headset (at least that I have seen). This makes it extremely challenging to enter complex passwords from password managers, etc.
I have read some articles that say it might be possible to pair a bluetooth keyboard with the headset, which would be slightly better, but still doesn't allow me to copy/paste from my password manager.
Does anyone know of a way to achieve this?
After some Googling/SO'ing, it seems like this might be possible using the Android Debug Bridge (adb) (Oculus has their own help page for it as well)
Your device needs to be in developer mode for this to work:
Create/join an organisation in the Oculus Dashboard
Open the Oculus app on your mobile phone.
In the Settings menu, select the Oculus Quest headset that you’re using for development.
Select More Settings.
Toggle Developer Mode on.
If you're using homebrew on macOS, you can install adb with:
brew cask install android-platform-tools
Next, plug your headset into your computer with the USB-C cable. You then should be able to list connected devices:
adb devices
If it says 'unauthorized', check in the headset for a dialog box asking for permission to connect. Ticking 'always allow' will make this easier in future.
At this point, we should be good to send text to the device. In the headset, focus a field that you want to 'type' into, then use adb shell input to 'type' your text:
adb shell input text "sometext"
It seems it is also possible to send a 'paste' command using adb shell input keyevent:
adb shell input keyevent 279
In older Android devices, you could send a 'copy' command in a similar way, but this has since been deprecated:
service call clipboard 2 i32 1 i32 0 s16 "text"
It seems that on newer devices, you need to leverage an external service (eg. Clipper) to 'copy to clipboard'. Using Clipper, you can send a command in adb shell such as:
am broadcast -a clipper.set -e text "text"
There are many different inputs we can send using these methods. You can find a full list of KeyEvent's in the Android Developer Documentation.
Using one (or more) of these methods, it should be possibly to 'copy'/'paste'/'type' passwords stored in a password manager on your computer 'into' the Oculus Quest headset.

How do I view my site on multiple screen sizes?

Ok, so I know how to write code for multiple screen sizes. But, I have no idea how to view my code on a mobile device before making my site go live. Please help!
You can play around with emulators which can simulate a variety of cellular devices. These can be downloaded using a program called Bluestacks for example.
If you have Google Chrome you can open a website and press F12 (on windows) to enter Developer Mode.
On the top left you can see a little smartphone icon.
Click it and choose a device. Then refresh the page.
Chrome will emulate the experience of a smartphone user straight from your computer, sou you can test it from there.
This is a view of this question on the emulator:
Here is the solution if you are using safari.
Enable the "develop" menu bar using Safari > Preferences > Advanced. Your menu bar should look like this:
Go to your website
Go to Develop > User Agent and choose the device/browser you wish to emulate.
You have two options.
Use of Emulators.
What you need - is any modern browser. Nearly every modern browser will offer you roughly similar emulator capabilities where you can select a target device/resolution. #intboolstring & #Pither has already mentioned safari & chrome options for you. IE & Edge have similar features (which you can probably explore yourself or see this link IE Emulator feature).
Using actual devices.
What you need - 1) wireless router 2) your dev machine/laptop which has a web server (like IIS on windows) & 3) some mobile devices (I would assume you would have atleast one smartphone which has a mobile browser on it).
You will need to connect your dev machine/laotop & your device(s) to the wireless and setup firewall on your dev machine to allow access to your website on your local wireless network. Check out this answer.
Once this is done, you should be able to load your site on any device connected on your wireless by tying http://your.dev.machine.ipv4:port-if-applicable/landingpage.html in the mobile browser.
(to find your machine's ipv4 address, goto command prompt and type ipconfig and press enter - I am assuming you are using windows)
You may be limiting your testing to a much smaller set of devices (ones you have access to). But this will give you a real-world idea (if not a much better one) of how you site renders & behaves on devices.

adb command doesn't list my device

On a Macbook Pro with Yosemite -
After getting through the difficulties of getting Android SDK installed, I plug in the device, but it doesn't show. The command adb devices yields "List of devices attached" with nothing following. It's there on the USB, the About This Mac System Report shows it present on the USB.
This question looks similar to Issue setting up the development environment for ProjectTango developemnt Device but is not the same because I'm not using Eclipse.
Please ensure that USB debugging is enabled in order to enter ADB, go to Settings > About tablet > Build number and then press Build number seven times. Then press back and go to Developer options > USB debugging.
Make sure you're using the latest Google USB driver. I was having this problem (but on Win 8) and updating the driver fixed it, I'm now getting the device in adb devices and can push content to it.

Installing Target Bar file in Blackberry 10 alpha Simulator

I have question w.r.t BB10 BAR file installation in Alpha Simulator.
I created a blackberry 10 casecade application on QNX Momentics IDE. Application works fine on Blackberry 10 alpha simulator when i use the 'Simulator-Debug' mode.
I also created BAR file using 'Export Release Build' wizard from bar-descriptor.xml. BAR created successfully. Later i cleaned up BB 10 alpha simulator and able to install the bar file using vnBB10 tool. It works great.
The question here is Why the app is not running in the BB 10 Simulator When i create a BAR file using 'Device-Release' mode and signed the BAR? (Actually speaking, i installed the device-release BAR file in Simulator. I can see application icon & Splash screen. it also shows the Blackberry permissions window. But after that it stopped abruptly. There was no logs to explore)
-> do you think 'Device-Release' Bar is only made for BB 10(Z10/Q10/Playbook) devices? not for Simulators ?
-> How can i create a single BAR which can run on both BB 10 Device & Simulator?
I really appreciate you for looking into this query.
~albeee~
Device-Release and Device-Debug will build arm binaries while Simulator-Debug will build x86 binaries. Essentially, the processor between real device and simulators are completely different and you need to tell the cross compiler which architecture you are targeting. That's why Device-Release/Device-Debug will never run on the simulator and why Simulator-Debug will never run on a real device.
There might be a way to package both architectures in one bar, but why would you want to? The simulator doesn't require signed bars and is only for development.

Resources