2017년 5월 18일 목요일

Call a different camera app instead default. Error 201


I've searching the forum about "Error 201: The Camera did not return an image", but I see no solution.

My app works ok if I call default camera app, but we need to use a different one (https://play.google.com/store/apps/details?id=com.jkfantasy.gpsmapcamera) and we get the error afte pic is taken.



Is there another way of calling the app in order to get the file path? As a intent maybe?

--
how did you call that camera?
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

--
I call the Camera Component. If I choose default camera, I get the path in the label. If I choose the other cam app, get the error.

-- 
you can try to use the actvity starter
see here how to find the correct parameters
in chapter Discovering how to set the ActivityStarter properties

--
|I've searching the forum about "Error 201: The Camera did not return an image"This error will be returned if the user starts the .TakePicture method and click then the BackButton, because it doesn't return an image.

refer to: search for Error 2001

--
Thanks both of you for the answer. I will try what Taifun says, but a question: 
I read the chapter time ago, and I didn't try it because it says calling default appthrough Camera component it's the same that Camera component does. I will try anyway. 
I suppose I shoud see ActivityPackage name of the app I want to use, right?

Nico, I don't click the BackButton, but the "Accept" button. Thanks
Start the Camera
To launch the Android Camera app, use an activity starter with the IMAGE_CAPTURE Action property. You do not specify an ActivityPackage or an ActivityClass:
Action: android.media.action.IMAGE_CAPTURE

This is basically what the App Inventor Camera component does, although it is more convenient to use the Camera component than to use the ActivityStarter in building your app.

-- 
Using the Activity Starter 
in chapter Discovering how to set the ActivityStarter properties
Discovering how to set the ActivityStarter properties If you want to start an app and you you don't have the source code or documentation, you might still be able figure out the package name and class name (and sometimes the intent) by launching the app and inspecting the Android system log.For example, if you use the YouTube application to play a video, you'll see in the log:I/ActivityManager(   86): Starting activity: Intent { act=android.intent.action.VIEW dat=vnd.youtube:nAPk9ycCbfc cmp=com.google.android.youtube/.PlayerActivity }If you can find the "cmp=" string, then the ActivityPackage is the part before the slash, e.g.,  com.google.android.youtube.  The ActivityClass is is the entire "cmp=" part, without the slash character, e.g., com.google.android.youtube.PlayerActivity.   There may also in general be "dat=" information that should be specify as the DataUri property.

I normally use Eclipse and Logcat there, but if you have installed the App InventorSoftware (see also Installing and Running the Emulator in AI2), you already have everything you need to use logcat...

How to use Logcat
1. connect your device using USB with your computer
2. in File Manager go to the App Inventor directory, which is  C:∖Program Files∖App Inventor or similar
3. press Shift and right mouse click the subdirectory commands-for-Appinventor to get the context menu
4. select "open command window here" and you will get a command window of that subdirectory
5. enter adb logcat *:E and the logcat will start running and log all errors
6. start your app to elicit the error
7. copy the log (see below)

To copy your log, right click, click "select all" and enter to copy the complete log into the clipboard, then open Notepad and paste it using ctrl-v.



--
Thanks, I will try and report

--

댓글 없음:

댓글 쓰기