Jump to content
Chester Wilson

android camera problem

Recommended Posts

On 3/10/2021 at 12:22 PM, Chester Wilson said:

I am having great difficulty getting a firemonkey programme to take piccies on an android device.

 

This is the simplest programme I have managed to put together for this.  It keeps blowing up no matter what I try!

(I have put 3 full days work into it, with no success, and now seek help!)


I am using Delphi in Embarcadero® RAD Studio 10.4 Version 27.0.37889.9797
(it will be a month before I can get home to download Sydney).

The phone I am working on is a Huawei P20 Pro with android 10 (can I have
android 7 back please?????)

 

I got Marco's GitHub main form for a camera, and got the same error from it.

I wondered if it were a Delphi bug, and sent it off to Quality.Embarcadero.
Dave Nottage kindly replied, telling me to set the permissions.  However,
if the permissions are not set, the error message is different, and setting
the permissions did not help.  I sent back that Dave's considered response did
not help any, but have heard nothing since.

 

It is necessary to run it once, then go and set up the android settings permissions
since android have become cripplingly paranoid from V10.

 

The error message is:
Project TryCamera1.spk raised exception class EJNIException with message
'java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData
(android.content.pm.PackageManager, java.lang.String)' on a null object reference'.

 

The crash comes on ExecuteTarget in FMX.MediaLibrary.Action
where it is called with FCameraService.TakePhoto

TryCamera1.dpr

TryCamera1.dproj

TryCamera1.dproj.local

TryCamera1.identcache

TryCamera1.res

TryCameraMainUnit.fmx

TryCameraMainUnit.pas

TryCameraMainUnit1.fmx

TryCameraMainUnit1.pas

@Chester Wilson If you will get java.lang.NullPointerException it is because Project Options >> Application >> Entitlement List >> Secure File Sharing is not set to true.

Took me a while to figure it out as the documentation on that seems hidden :).

Probably you figured this out already...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×