iOS: yes, you can.
Go to the device Settings > tap on Weight Loss Running > enable Motion & Fitness option.
When you run on a treadmill, open the app Home screen, tap Start and activate the Indoor mode. Important: the app tracks the stats only if you keep your iPhone in the pocket or on your arm. Otherwise you have to fill in the logs manually: Menu > Workouts > choose your workout > Show details > Pencil icon > enter the parameters you see on a treadmill screen > tap the check mark icon to save the logs.
Android: you can, but have to fill in the logs manually.
When you run on a treadmill, open the app Home screen, tap Start and enable Treadmill mode. When the workout is finished, go to Menu > Workouts > choose your workout > Show details > Pencil icon > enter the parameters you see on a treadmill screen > tap the check mark icon to save the logs.
Have a great workout in the gym!