Wednesday, October 23, 2013

[android-developers] action_image_capture intent restarts app

I have been several days looking for the solution to this problem and I dont know what to do :(

I have an app which uses native camera to take a picture, but the problem is that, sometimes, and only in some devices when I took the picture and save it and go back, my app restarts.

Its a webview so much of it logic is made in the server side, but use a javascript interface for handle native function such as the camera.

Its very difficult to catch becouse it only happens in some devices, even if they are the same model, I have two galaxy ace and in one almost always happen and in the other very few times(these are not the only devices which I have tested)

I think it is related with the orientation of the camera or something like that. Because seems to happen more often when I rotate the device in the save/discard screen(after taking the picture)


This is some of my code:


manifest:

            <activity
            android:name="XXX"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:excludeFromRecents="false"
            android:label="@string/XXX"
            android:launchMode="singleTask"
            android:taskAffinity=""
            android:windowSoftInputMode="adjustPan" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


camera.class

    public void showNativeCamera(){
 
// create Intent to take a picture and return control to the calling application
       Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
       
 
       UUID uniqueKey = UUID.randomUUID();
    mPictureName = "img_" + uniqueKey.toString() + ".jpg"; 
       fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
       Log.d("amanda", "file uri: " + fileUri);
       intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name

       
       intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
       
       // start the image capture Intent
       mParent.startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}


Logcat:


10-23 13:42:45.250: V/CropImage(12042): Crop = no, Return = specified uri
10-23 13:42:45.257: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=ActivityManager-Launch
10-23 13:42:45.265: V/CropImage(12042): onPause
10-23 13:42:45.273: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=SCREEN_FROZEN
10-23 13:42:45.273: I/WindowManager(1528): Setting rotation to 1, animFlags=1
10-23 13:42:45.289: I/ActivityManager(1528): Config changed
10-23 13:42:45.375: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=SCREEN_FROZEN
10-23 13:42:45.406: E/ClockWidget(11247): clock_bg portrait
10-23 13:42:45.406: E/ClockWidget(11247): drawDayText
10-23 13:42:45.406: E/ClockWidget(11247): width= 50
10-23 13:42:45.406: E/ClockWidget(11247): widthText= 72.0
10-23 13:42:45.406: E/ClockWidget(11247): RIGHT
10-23 13:42:45.421: V/Camera(11982): --onActivityResult--requestCode: 2001
10-23 13:42:45.421: V/Camera(11982): --onActivityResult--resultCode: -1
10-23 13:42:45.421: V/Camera(11982): --onActivityResult--data: Intent { act=inline-data (has extras) }
10-23 13:42:45.453: V/CropImage(12042): onDestroy
10-23 13:42:45.914: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=ActivityManager-Launch
10-23 13:42:45.921: W/ActivityManager(1528): Duplicate finish request for
10-23 13:42:45.929: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=SCREEN_FROZEN
10-23 13:42:45.929: I/WindowManager(1528): Setting rotation to 0, animFlags=1
10-23 13:42:45.937: I/ActivityManager(1528): Config changed
10-23 13:42:46.023: E/ClockWidget(11247): clock_bg portrait
10-23 13:42:46.023: E/ClockWidget(11247): drawDayText
10-23 13:42:46.023: E/ClockWidget(11247): width= 50
10-23 13:42:46.023: E/ClockWidget(11247): widthText= 72.0
10-23 13:42:46.023: E/ClockWidget(11247): RIGHT
10-23 13:42:46.054: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=SCREEN_FROZEN
10-23 13:42:46.210: I/ApplicationPackageManager(12075): cscCountry is not German : ANC
10-23 13:42:46.218: D/amanda(12075): onCreate() called
10-23 13:42:46.281: I/webclipboard(12075): clipservice: android.sec.clipboard.ClipboardExManager@4052c190
10-23 13:42:46.398: V/geo aca(12075): pklsajdf
10-23 13:42:46.398: V/geo aca(12075): android.location.LocationManager@405378d0
10-23 13:42:46.406: V/acastart(12075): lpm
10-23 13:42:46.414: V/asd(12075): [network, passive, gps]
10-23 13:42:46.421: D/androidNlpServiceThread(8458): adding listener com.google.android.location.internal.client.NetworkLocationClient$1@405a5b48 with period 45
10-23 13:42:46.421: D/androidNetworkLocationListeners(8458): Still have listener com.google.android.location.internal.client.NetworkLocationClient$1@405a5b48
10-23 13:42:46.421: D/WifiService(1528): [mPersistState] : On
10-23 13:42:46.421: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=NetworkLocationLocator
10-23 13:42:46.421: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=WifiService
10-23 13:42:46.421: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=WifiService
10-23 13:42:46.437: D/androidNlpServiceThread(8458): adding listener com.google.android.location.internal.client.NetworkLocationClient$1@405a5b48 with period 45
10-23 13:42:46.437: D/androidNetworkLocationListeners(8458): Still have listener com.google.android.location.internal.client.NetworkLocationClient$1@405a5b48
10-23 13:42:46.437: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=RILJ
10-23 13:42:46.445: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=RILJ
10-23 13:42:46.453: E/wpa_supplicant(4553): Ongoing Scan action...
10-23 13:42:46.460: D/PowerManagerService(1528): acquireWakeLock flags=0x1 tag=RILJ
10-23 13:42:46.468: D/PowerManagerService(1528): releaseWakeLock flags=0x1 tag=RILJ
10-23 13:42:46.476: D/amanda(12075): onActivityResult() called
10-23 13:42:46.484: D/amanda(12075): onActivityResult error: null

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate