Even if you also have gyroscopes, the errors from them and from the accelerometers will be too large when integrated over any useful period of time and the results for position will have huge errors.
What you would be constructing is an inertial navigation system (INS). This requires highly accurate instruments such as you find in the INS used in military and other aircraft. An accurate INS is much bigger than you could fit in a smartphone - even those ridiculously large ones they are marketing nowadays!
Even a military-grade INS has errors and its data is usually mixed with GPS data to provide a highly accurate and resilient navigation system. This integrated system is also used in commercial aircraft.