Alright, so this fork of the original app does the following:
- Fully transparent (you can't see it's there when it's running)
- Runs automatically on boot
- Notifies you with a Toast ("Fixing camera...")
- Does not show-up in the recent apps panel
- Does not block the UI thread (you can for example use the status bar while the app does its thing (5sec), but of course any touch below that will be intercepted by the activity, it's transparent but it's there).
- You choose if you want a version with a launcher icon (I made it nice & flat so it's bearable to have in your app drawer) or without a launcher icon
The code is available on my github and licensed under the Apache v2 license.
The apks are also hosted at github.
Downloads
- With launcher icon: https://github.com/Androguide/Z1CameraFix/releases/tag/v1.0.0
- Without launcher icon: https://github.com/Androguide/Z1CameraFix/releases/tag/v1.0.0b
Big thanks to @drklaw for the original idea & implementation!
The problem is you can't do that.Superb work again man.. Can't thank u guys enough
As i stated earlier -
"Just a suggestion.. Can u make something like "Restart Camera App" or something like that or u can modify this app only as if Camera broken after a day or two so we didn't have to reboot the phone as ur app doesn't fix it once it's broken and v ll have to reboot. By this we just use Restart Camera App and then use ur App and have a perfect camera without a Reboot.
Thanks in Advance"
Sent from my Xperia Z1 using XDA Premium 4 mobile app
The problem is you can't do that.
Even when developing Camera-related apps on a device with fully working camera it's a P.I.T.A because once the Camera object instance hasn't been release()'d properly and you get the dreadful "Cannot connect to the camera" dialog, the only thing that'll fix it is a reboot.
What you could do if you still have the issue after using the device for a couple of days is to set Tasker to reboot your device every night while you're sleeping.
- Runs automatically on boot
- Notifies you with a Toast ("Fixing camera...")
- Does not block the UI thread (you can for example use the status bar while the app does its thing (5sec), but of course any touch below that will be intercepted by the activity, it's transparent but it's there).
I've installed the apk above (with icon), but still in the last 24 hours had one instance of the camera error.
Have checked and the z1 camera fix is definitely set to auto start on boot (checked with a startup manager).. so not sure if this is not working at all..
Im on PA 4.4 beta1 on Z1..
Should I try using tasker to start it as well? is it possible that something in kitkat stops it starting automatically even though its in startup items? not really sure how I can tell if it actually starts on bootup?
You will see a small message directly after logging in when the app is started. Do you use an app which is activating Kernel SamePage Merging KSM?
sorry if it seems like a stupid question, but does this fix work for LB unrooted stock 14.4.a.0.133 with stock kernel?
Alright, so this fork of the original app does the following:
- Fully transparent (you can't see it's there when it's running)
- Runs automatically on boot
- Notifies you with a Toast ("Fixing camera...")
- Does not show-up in the recent apps panel
- Does not block the UI thread (you can for example use the status bar while the app does its thing (5sec), but of course any touch below that will be intercepted by the activity, it's transparent but it's there).
- You choose if you want a version with a launcher icon (I made it nice & flat so it's bearable to have in your app drawer) or without a launcher icon
The code is available on my github and licensed under the Apache v2 license.
The apks are also hosted at github.
Downloads
- With launcher icon: https://github.com/Androguide/Z1CameraFix/releases/tag/v1.0.0
- Without launcher icon: https://github.com/Androguide/Z1CameraFix/releases/tag/v1.0.0b
Big thanks to @drklaw for the original idea & implementation!
sorry if it seems like a stupid question, but does this fix work for LB unrooted stock 14.4.a.0.133 with stock kernel?
I already installed the apk with icon and when I restart the phone I see a toast saying "fixing camera". so does this mean it's working or do I need to root or something?
Thanks a lot.
This was meant for AOSP roms not stock it won't do anything for stock Sony firmware
import android.graphics.SurfaceTexture;
import android.hardware.Camera;
import android.os.Bundle;
import android.app.Activity;
import android.view.TextureView;
import android.view.TextureView.SurfaceTextureListener;
public class MainActivity extends Activity implements SurfaceTextureListener{
private Camera mCamera;
private TextureView mTextureView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mTextureView = new TextureView(this);
mTextureView.setSurfaceTextureListener(this);
setContentView(mTextureView);
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
mCamera = Camera.open();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
mCamera.release();
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// Ignored, the Camera does all the work for us
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mCamera.stopPreview();
mCamera.release();
return true;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// Update your view here!
}
}
Ya it will do but u ll have to do this by ur own on as soon as ur device boots up because if u don't do it and opens camera app and if it showed Can't connect the Camera Error and then after that if u press this app then it won't be able to help u.. It will crash, happened with me.
Sent from my Xperia Z1 using XDA Premium 4 mobile app