In a saucepan, mix the apples, onion, ginger, vinegar, white sugar, brown sugar, cinnamon, white pepper, cardamom, and nutmeg. Bring to a boil, reduce heat, and cover. Simmer 30 minutes, stirring frequently, until the apples are tender. Mix in some water if necessary to keep the ingredients moist. Remove the onion and ginger, and store in the refrigerator until ready to serve.