Tell me how to implement the following algorithm correctly: created service:

public class ServiceCamera extends Service { @Nullable @Override public IBinder onBind(Intent intent) { return null; } 

}

This service should be launched immediately after clicking on the application's icon, the application without activating, that is, clicking on the icon started the service, which in turn performed the action to start the camera. How to start the camera through the service and start recording video?

1 answer 1

Absolutely without it will not work, you need at least without markup, in which the finish(); method will be called finish(); immediately after launch.

How to create a service, you can see here - Service. A simple example. _http: //startandroid.ru/ru/uroki/vse-uroki-spiskom/157-urok-92-service-prostoj-primer.html

Further, the automatic start of the camera in Android is impossible starting from API 23 - you first need to obtain dynamic permissions. A little about them is told on Habrahabr - Android runtime permissions _https: //habrahabr.ru/post/278945/ - to work with them, you also need Activation.

The third is video recording from the camera. A very simple example is shown here - Recording Video Simple . This is official documentation, but it is in English. I think it’s easy for you to understand the main code.

Hope this helps you. Good luck!