I couldn't make it work with this approach, so I created a service in which I started flashlight as a service. Then from the transparent activity I created an if statement which will start the sercvice if not running by checking a blobal boolean flag(which is included in service class), or stop it if already run. The only problem now was that the system kill the flashlight service very easy, so I inclued the startForeground method like this:
Notification fakenote = new Notification( 0, null, System.currentTimeMillis() );
fakenote.flags |= Notification.FLAG_NO_CLEAR;
startForeground( 2, fakenote );
Also I put stopForeground(true) in onDestroy method. Now seems that works fine. Is there any way to prevent system completely from killing the service, so it can be killed only by the app, or this is the best can be done?