Hmm, I'd be a bit concerned about the apple juice, personally - but then my LO is nearly 1 year and still can't digest apples, they give her horrible tummy ache, dodgy poo and nasty nappy rash. So I am probably biassed! Did you notice if this night time writhing around got worse or better when you started the apple juice? You might want to make sure that you give the apple early in the day to avoid it causing problems at night.
I am not sure what else to suggest, we have never had problems with constipation - I am sure others will have some ideas for you
Bryony