Good day. There is a need to create an application for smart watches under android wear. Specialized analog media player.
The application is written .. everything starts, but it works for exactly 25 seconds until the clock screen goes out.
Type options:
Take-out of the playback module to a separate service:
startService(new Intent(this, MyService.class));Creating a separate stream in service:
public int onStartCommand(Intent intent, int flags, int startId) { new Thread(new Runnable() { @Override public void run() { play(); } }).start(); return super.onStartCommand(intent, flags, startId); }
also work until the screen is turned off. Tell me how to start the service in android wear, so that Ambient Mode and any other screen off modes will not interrupt it. Or at worst, do not let the clock go off while the application is running.