I am trying to modify my existing contacts on my device.
I have implemented all the related stuff (AuthenticationService, AbstractThreadedSyncAdapter, SyncService, AbstractAccountAuthenticator etc..) following this guides/examples and this.
All works fine on my Samsung Galaxy S7 that has Android 7: now my contacts have a new custom function, if I select it, an Activity of my Application is launched. This is accomplished creating a contacts.xml file and using a custom MIMETYPE (as explained in the links above).
Unfortunately this approach seems to not work on devices running Android with version < 7. My custom function is not shown although everything seems to work correctly and no error is detected.
If someone knew something concerning it, it would be a great help.
Thanks in advance.
I'm assuming the ";" in your contacts.xml is a typo, or your project wouldn't compile
Try removing the android:detailSocialSummary line from your contacts.xml as most examples I know don't have that
Instead of ContactsAccountType try ContactsSource, see this as reference.
The mimetype usually doesn't point to an activity within your app, it should be: vnd.android.cursor.item/vnd.<your package>.<some action> but I don't think that's the problem you're having
Check Mime Type line, you must have to add .profile at the end and /vnd..profile
<?xml version="1.0" encoding="utf-8"?>
<ContactsSource
xmlns:android="http://schemas.android.com/apk/res/android">
<ContactsDataKind
android:mimeType="vnd.android.cursor.item/vnd.com.krishna.test.profile"
android:icon="#mipmap/ic_launcher"
android:summaryColumn="data2"
android:detailColumn="data3" />
</ContactsSource>
I'm trying to set the ISO for the Samsung Galaxy S5 using the Camera API.
The parameters which includes the ISO tag in the Camera Parameters (retreived using camera.getParameters.flatten();) are:
exif_iso=0;
iso=auto;
iso-values=auto,ISO_HJR,100,200,400,800,1600;
I quess that the exif_iso parameter has something to do with the Meta file, so i don't need that. The iso setting is what i need, and i can choose all the values stated under iso-values. If i set one of these parameters, the parameters are accepted (no exception is getting thrown). If i use a parameters which isn't stated under the values, an exception is thrown. So the value of iso are set!
But... the strange thing is that when you take a picture, the iso setting seems to be ignored. Settings like white balance and resolution work like a charm, but i can't get the iso to change. On another phone (galaxy S2) the iso setting does work.
In the official camera app from samsung, the iso value is editable, so somewhere in the api it should be possible! I have tried some camera apps from the play store (including open camera 1.20) but the same thing; you can change the value but it gets ignored.
Has anyone any idea why the value is ignored? is there maybe another parameter which enables or disables this kind of settings?
Thanks a lot :)
Update:
I'am a little bit further. It seems to be caused by OpenCV which i also use in my app. Specifically the class CameraBridgeViewBase seems to cause the iso setting problem. Even i disable the view before taking the picture, the iso settings are getting ignored. I've build a little camera app without the use of OpenCV and the iso is set just like it should.
If an app with CameraBridgeViewBase been running (even if you clear the memory after that) my camera test app iso settings are ignored again. I also tried the app 'open camera', the iso settings are simply ignored again. If i start the official samsung camera app, it seems like it resets the whole camera; My camera test app and 'open camera' iso setting work again after that.
The weird thing of all is that this problem doesn't occur at all on my Samsung Galaxy S2. It only occurs on the Samsung Galaxy S5...
CameraBridgeViewBase: OpenCV class which is used to capture (video)frames from the camera, show it and implements a 'onFrameListener' function.
Parameters =
phase-af-values
focallength-value-denominator=100
brightness-step=1
zoom=0
redeye-reduction-values=enable,disable
exif_iso=0
max-num-detected-faces-hw=10
scene-detect-values=off,on
qc-camera-features=542
face-detection-values=off,on
dynamic-range-control-values=
whitebalance=auto
max-sharpness=36
focallength-value-numerator=480
preview-format-values=yuv420sp,yuv420p
jpeg-thumbnail-quality=85
preview-format=yuv420sp
face-detection=off
auto-exposure-values=matrix,center,spot
iso=auto
fast-fps-mode=0
mce-values=enable,disable
flash-mode-values=off,auto,on,torch
preview-frame-rate=30
jpeg-thumbnail-width=512
video-size=1920x1080
scene-mode-values=auto,hdr
redeye-reduction=disable
preview-fps-range-values=(10000,30000)
histogram=disable
face-recognition=off
camera-mode=0
preview-size-values=1920x1080,1440x1080,1280x720,1056x864,960x720,800x480,720x480,640x480,352x288,320x240,176x144
maxaperture-value-denominator=100
saturation-step=1
touch-af-aec=touch-off
smart-screen-exposure-values=vision-ae-normal,vision-ac-backlight
preview-fps-range=10000,30000
auto-whitebalance-lock=false
min-exposure-compensation=-4
llv_mode=0
antibanding=auto
max-num-focus-areas=1
face-recognition-values=off,on
vertical-view-angle=38
video-stabilization-supported=false
sce-factor-step=10
maxaperture-value-numerator=228
qc-max-num-requested-faces=10
min-saturation=0
max-saturation=10
contrast-step=1
raw-size=5328x3000
max-brightness=6
supported-live-snapshot-sizes=5312x2988,4128x2322,4000x3000,3264x2448,3264x1836,3200x2400,2592x1944,2048x1536,2048x1152,1920x1080,1600x1200,1440x1080,1280x768,1280x720,1024x768,800x600,800x480,800x450,720x480,640x480,352x288,320x240,176x144
max-contrast=10
min-sce-factor=-100
picture-format-values=jpeg,bayer-qcom-10gbrg,bayer-qcom-10grbg,bayer-qcom-10rggb,bayer-qcom-10bggr,bayer-mipi-10gbrg,bayer-mipi-10grbg,bayer-mipi-10rggb,bayer-mipi-10bggr,yuv422sp
video-hfr=off
supported-shot-modes=normal-shot,panorama-burst
exposure-compensation-step=0.5
scene-detect=off
fnumber-value-numerator=220
picture-size=1920x1080
saturation=5
whitebalance-values=auto,incandescent,fluorescent,daylight,cloudy-daylight
picture-format=jpeg
zsl=off
lensshade-values=enable,disable
selectable-zone-af=auto
video-hfr-values=60,90,150
iso-values=auto,ISO_HJR,100,200,400,800,1600
selectable-zone-af-values=
lensshade=enable
preferred-preview-size-for-video=1920x1080
anti-shake=0
min-sharpness=0
intelligent-mode=0
mce=enable
hfr-size-values=2664x1500,1328x748,824x496
snapshot-picture-flip=off
zoom-supported=true
metering=center
denoise-values=denoise-off,denoise-on
zsl-values=off,on
sharpness=36
phase-af=off
contrast=5
scene-mode=auto
jpeg-quality=96
dynamic-range-control=off
histogram-values=enable,disable
exif_exptime=0
metering-areas=(0,0,0,0,0)
min-contrast=0
video-size-values=1920x1080,1440x1080,1280x720,800x450,800x480,720x480,640x480,352x288,320x240,176x144
skinToneEnhancement=0
rt-hdr=off
preview-size=1920x1080
focal-length=4.80
ae-bracket-hdr-values=Off,AE-Bracket
denoise=denoise-on
video-flip=off
max-sce-factor=100
preview-frame-rate-values=15,24,30
max-num-metering-areas=10
preview-flip=off
focus-mode-values=auto,infinity,macro,continuous-video,continuous-picture
vtmode=0
jpeg-thumbnail-size-values=512x288,480x288,256x154,432x288,512x384,352x288,320x240,176x144,0x0
zoom-ratios=100,104,109,114,119,125,129,134,139,144,150,154,159,164,169,175,179,184,189,194,200,204,209,214,219,225,229,234,239,244,250,254,259,264,269,275,279,284,289,294,300,304,309,314,319,325,329,334,339,344,350,354,359,364,369,375,379,384,389,394,400,404,409,414
dis-values=enable,disable
dual_mode=0
picture-size-values=5312x2988,3984x2988,3264x2448,3264x1836,2560x1920,2048x1152,1920x1080,1280x960,1280x720,800x480,640x480
touch-af-aec-values=touch-off,touch-on
smart-screen-exposure=0
luma-adaptation=3
min-brightness=0
horizontal-view-angle=62
firmware-mode=none
imageuniqueid-value=F16QLHF01GB
Android Studio 0.4.6
Hello,
I am trying to use the camera and I have set the permissions like this:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<uses-feature android:name="android.hardware.camera"/>
I have imported the correct package:
import android.hardware.Camera;
And I try and open the camera like this:
Camera camera = Camera. there is no open method;
All I get are the following:
Parameters
Class
Size
I have follow the developer documentation, I can't see I have done anything wrong.
many thanks for any suggestions,
Just try to paste camera = Camera.open(); or type it in manually. Sometimes the "clever" thing glitches.
By the way, did the tool suggest to import android.hardware.Camera; or you typed it manually? I mean, is it an Android project? (Typically you start with the automatically generated hello world example and then add extra functionality to it, if you did something else, it's easier to re-do it from the very beginning.)
For anyone in the future facing the same issue
import android.hardware.*;
I want to use zxing in an android project. I have download the code and the example app is running now (ZXingTestActivity). For your information, i am not very familiar with coding native android.
I want to use zxing to scan qr-codes to configurate an application. To avoid confusion between normal qrcodes and configuration qrcodes i want to print inverted/negative qrcodes on screen or paper.
To be able to scan these inverted/negative qrcodes, the camera must be in negative mode. How can i do this? I am not sure where to start, however....
In the ZXingTestActivity.java there is a clicklistener that specify some extra parameters to the IntentIntegrator, for example:
private final Button.OnClickListener scanProduct = new Button.OnClickListener() {
#Override
public void onClick(View v) {
IntentIntegrator integrator = new IntentIntegrator(ZXingTestActivity.this);
integrator.addExtra("SCAN_WIDTH", 800);
integrator.addExtra("SCAN_HEIGHT", 200);
integrator.addExtra("RESULT_DISPLAY_DURATION_MS", 3000L);
integrator.addExtra("PROMPT_MESSAGE", "Custom prompt to scan a product");
integrator.initiateScan(IntentIntegrator.PRODUCT_CODE_TYPES);
}
};
Is it possible to add camera settings with addExtra and how do i format this? Is it possible? Or is there another way to configurate the camera to inverted/negative mode?
I do not know if it completely impossible with ZXing but with ZBar it is possible!
First download the ZBar android version on sourceforge:
http://sourceforge.net/projects/zbar/files/AndroidSDK/
Add project to eclipse
Open CameraPreview.java
Add a private var to the class:
private Camera.Parameters mCameraParams;
Add the following lines after the line: mCamera = camera; in the constructor CameraPreview:
mCameraParams = camera.getParameters();
mCameraParams.setColorEffect(Camera.Parameters.EFFECT_NEGATIVE);
mCamera.setParameters(mCameraParams);
That's it! (run the project)
Also think that ZBar is faster to detect damaged barcodes. Is the same as the PC-version i have used in another project and does the job very well. Blink with your eyes and the code is there. No fancy things at all, just good!
#Erwinus, here's the code. I hope it's now clear why it is something you have already been completely given in previous comments. More homework and fewer accusations makes SO a happy place.
mCameraParams = camera.getParameters();
if (mCameraParams.getSupportedColorEffects().contains(Camera.Parameters.EFFECT_NEGATIVE) {
mCameraParams.setColorEffect(Camera.Parameters.EFFECT_NEGATIVE);
}
mCamera.setParameters(mCameraParams);
Sorry there's not a way to do this via Intent. A clean patch adding this as an option would be attractive to commit. The only gotcha is that the camera must support the "negative" mode. Then it's trivial (you can see this behavior as a selectable option in Barcode Scanner+). Otherwise you have to flip the image yourself. Not hard, but takes a bit of code and CPU cycles.
Android contains a permission called 'ACCESS_LOCATION_EXTRA_COMMANDS'. Normal location commands would involve accessing coarse/fine location. Does anyone know what kind of extra commands this permission allows the app to access ?
Thanks.
I only know of 1 command which can be uses when you have a slow GPS fix:
((LocationManager)YourActivity.this.getSystemService("location")).sendExtraCommand("gps", "delete_aiding_data", null);
and in the Manifest:
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
According to a rough search in Android source code, it indicate that LocationManager.sendExtraCommand() need this permission exactly.
Documentation: sendExtraCommand(java.lang.String, java.lang.String, android.os.Bundle)
Go to https://cs.android.com/android/platform/superproject/+/master:frameworks/base/services/core/java/com/android/server/location/provider/AbstractLocationProvider.java;drc=master;bpv=1;bpt=1;l=353, click on onExtraCommand if you don't see the "References" panel at the bottom, scroll down to "Overriden By", and click on each implementation to see what commands it supports.
Here's a list of commands supported by GnssLocationProvider (since all of the other implementations seem to do nothing or delegate to another one):
delete_aiding_data: calls deleteAidingData
force_time_injection: calls requestUtcTime
force_psds_injection: sends a DOWNLOAD_PSDS_DATA message if mSupportsPsds is true
request_power_stats: calls requestPowerStats