Not considering shitty licensed games like Sonic for Game.com, Sonic first appearence in a non-Sega system was in 1999 (Neo Geo Pocket) or on a home console in 2001 (GameCube).Sonic has been a third party franchise for 13 years.
Sonic was a first party franchise for 12 years.