How to open a specific camera with camera2 API - java

I am using a phone with 3 back cameras (Realme GT Pro 2) and I want to access the one with the widest FOV. I am currently trying to implement it with the help of the Multi-camera API, but it's relatively confusing and I'm unable to implement it/find a solution for this. Can anyone give me some tips on how to access the specific back camera and display its stream?
I can get the physicalCameraId with CameraCharacteristics.getPhysicalCameraIds(). But how can I use this to open the correct (physical) camera? I also know that some manufacturers haven't yet implemented/allowed this access

Related

RFID/ NFC based Buss pass system

I'm trying to work on Buss Pass System for my FYP. I am familiar with C# and Java programming languages and I wanted to use a concept where the travelers enter the bus and scan their RFID/NFC tag and if they are approved to board, the system should display Green Light if not it should display Red Light with a corresponding sound effect. My question for you is what kind of device should I use. Thank you!
Basically you have to decide whether you want some Android mobile phone/tablet to emulate the reader in the bus - consequently you will need to program it in Java.
Or you can decide to go with a RasPi with a NFC reader and use the GPIOs to drive some LEDs.

Having problems getting Weight Data with Android from a BLE Scale

I'm currently developing an android app for a weight scale I received that transmits data through bluetooth low energy.
I was looking at documentation and if I got the information correctly, there are specific UUIDs for data. I received a BLE scale with a Chinese protocol document found here: http://www.anj.fyi/protocol.pdf
I found and was able to get a functioning scanner working that lists the device name and the UUIDs it broadcasts.
Lets say I want just the weight data to show up in the UI, nothing else and nothing more.
I don't know what UUID they used for the weight data, and there are a lot of UUIDs. Probably 20+. I checked a UUID compilation and the usual weight data UUID does not show up.
How do I get the data from those UUIDs?
I'm thinking it might be the ones that are notifications, indications or read properties.
Looking at the UUID for example, f000ffc2.
How would I get data from that characteristic? Would anyone have an example code to grab the data from those UUIDs, or tutorials because I'm terribly lost right now.
I really appreciate it.
There are no weight information on the document you list http://www.anj.fyi/protocol.pdf, it is only shows the BLE module hardware interface spec, i.e. it does not specify the detailed service and characteristic.(I an a native Chinese speaker).
Regarding to the UUID you want to know which is the one to represent the weight, yes you are right it should be the read/notification feature without write permission. Can you use the apps e.g. lightblue on iOS to receive the notification(meanwhile change the value on your device) to test it? this will help you to understand which characteristic is the one you want.

Number plate recognition using android

I was wondering if anybody new of a way that I could use of scanning a registration plate on a car and then adding that number to a string inside java? I have been looking around a bit and came across this
https://github.com/SandroMachado/openalpr-android
But I'm not sure that it's exactly what I am looking for?
Anybody know of anything that might be of use? Thanks in advance!
Google has recently released Mobile Vision API for text recognition from images. You can take a picture from camera and then use this API to get your desired result. Link - https://developers.google.com/vision/text-overview

How can I increase number of audio streams for android?

I'm learning about android development. Let's say I want to be able to listen to spotify music in the background, while simultaneously listening to a spoken word podcast thru some other podcast app. Ive tried creating a Soundbuilder object and changed the maxStreams to 2 when I hit a togglebutton. However, when I run the app it makes no difference. Either spotify has the focus or the podcast app has focus.
Should I be utilizing the AudioManager class instead? To be able to eventually controll the volume of each stream independently? Also, would the phone have to be root to be able to change the maxStreams to 2?
I think You should check this example: MixingAudioInputStream.java
It's example taken from here
Check these out and try mixing both streams into single stream by Yourself - as trying to code new things is best way to learn.

Android Camera autofocus when user holds camera still

I'm sure most of you have used an android phone before and taken a picture. Whenever the user changes the mobile phone's position and holds it steady, the camera focusses automatically. I'm having a hard time replicating this in my app. The autofocus() method is being called only once when the application is being launched. I have been searching for a solution these past 3 days and while reading the google documentation I stumbled upon the sensor method calls (such as when the user tilts the mobile forwards or backwards). I could use this API to achieve what I need but it sounds too dirty and too complicated. I'm sure there's another way around it.
All examples on the internet which I have found only focus when the user presses the screen or a button. I have also gone through several questions on SO to hopefully find what I am looking for but I was unsuccessful. I have seen this question and that String is not compatible with my phone. For some reason the only focussing modes which I can use is fixed and auto.
I was hoping someone here would shed some light on the subject because I am at a loss.
Thankyou very much for your time.
Since API 14 you can set this parameter
http://developer.android.com/reference/android/hardware/Camera.Parameters.html#FOCUS_MODE_CONTINUOUS_PICTURE
Yes, camera.autoFocus(callback) is a one-time function. You will need to call it in a loop to have it autofocus continuously. Preferably you would have a motion detection via accelerometer or compass to detect when camera is moved.

Categories