Catalyzes the ADP-dependent phosphorylation of D-glucose to D-glucose 6-phosphate and glucosamine to glucosamine 6-phosphate. ADP + D-glucose = AMP + D-glucose 6-phosphate + H(+) ADP + D-glucosamine = AMP + D-glucosamine 6-phosphate + H(+) Binds 1 Mg(2+) ion per subunit. Carbohydrate degradation; glycolysis. Belongs to the ADP-dependent glucokinase family.