As per ARCore-2020, placing an anchor at the position where the camera is currently at, can be done by using
session.createAnchor(camera.getPose());
or
session.createAnchor(camera.getDisplayOrientedPose());
Because placing an anchor at
float[] pos = {0,0,-1};
float[] rotation = {0,0,0,1};
session.createAnchor(new Pose(pos, rotation));
creates an anchor at the global origin (where your session started).
Unless your hitresult can give you a trackable feature like a plane or a point, you can't create an anchor on a featureless wall.
If your application is designed for a specific use case, you can make some assumptions about the environment and formulate some vector relationship between an anchor which is at a featured area and a desired anchor at a feature less area.
For example.
If you want to place an anchor on a wall, which doesn't have any features. (Provided the camera is always in a tracking state).
I would first place an anchor at any 3 of the walls a, b, c, where I know there's most definitely a feature point that is trackable.
Create a plane, using these 3 points, the math for which can be found here
https://sites.math.washington.edu/~king/coursedir/m445w04/notes/vector/equations.html
Now to get the equation of a line along the direction in which the camera is looking ->
if camera pose = X = {x,y,z} and Q = {qx,qy,qz,qw}, Then the equation of the line = {x,y,z} + LAMBDA (Q.{0,0,-1})
where LAMBDA is a random variable along the line. and Q.{0,0,-1} signifies the rotation of of {0,0,-1} with the quaternion Q
So now if you want to place an anchor on the wall. You would find the point of intersection between the camera line and the wall plane.