> For the complete documentation index, see [llms.txt](https://portal-integracao.intelbras.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://portal-integracao.intelbras.com.br/linha-android/inicio-automatico-da-aplicacao/plano-de-inicio-automatico-da-aplicacao.md).

# Plano de Inicio automático da aplicação

### Plano de Inicio automático da aplicação

O plano de inicio automático, estabelece algumas recomendações para a criação do seu aplicativo para que o mesmo opere de forma "nativa" em seu cenário, permitindo o inicio automático da aplicação caso o dispositivo seja desligado e também evitando a interação do usuário com os recursos nativos do sistema Android.

Abaixo está um workflow de recomendação a seguir para criação de sua aplicação com essas características anteriores:

### Definindo a execução em tela cheia

Afim de evitar as interações do usuário com o sistema nativo, é possível definir a aplicação para executar em tela cheia, ocultando assim as informações do sistema nativo, outra recomendação é a utilização do teclado legacy do Android.

<figure><img src="https://4180028519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fma2XQlNnvN6M5jkwNkcX%2Fuploads%2FHvPDj65XJdf7xPDLzxV9%2Fenter_fullscreen.gif?alt=media&amp;token=087c4868-03f1-44a9-8557-5cb310350e5f" alt=""><figcaption></figcaption></figure>

```java
/**
*Enter full screen mode, close the status bar and navigation bar,
*The status will not be saved, and the device will return to normal mode after
restarting.
*
* @return refer to {@link ResultCode}
*/
public int enterFullScreen();

/**
*Exit full screen mode and display status bar and navigation bar
*
* @return refer to {@link ResultCode}
*/
public int exitFullScreen();

```

### Criação da função para escuta do fim de Boot

O aplicativo pode ouvir a transmissão de inicialização por conta própria e, em seguida, iniciar seu próprio processo interface de entrada principal através da interface startLaunchActivity.

<figure><img src="https://4180028519-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fma2XQlNnvN6M5jkwNkcX%2Fuploads%2FV8UjFBriqtvgfehS45U9%2Fboot_received.gif?alt=media&amp;token=21743368-062c-4e14-b617-625e1d5d233c" alt=""><figcaption></figcaption></figure>

```java

/**
* @Description: boot completed auto-start function
**/
public class BootReceiver extends BroadcastReceiver {
private static final String TAG = "BootReceiver";
@Override
public void onReceive(Context context, Intent intent) {
    Log.i(TAG, "onReceive: " + intent);
        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
        LamyPackageManger.getInstance().startLaunchActivity(context.getPackageName());
        }
    }   
}

```

Para processos que nunca foram iniciados após a instalação do APK, reiniciar o dispositivo irá não receber transmissões porque o sistema Android adiciona FLAG\_ EXCLUDE\_ STOPPED\_PACOTES por padrão ao enviar transmissões. As transmissões marcadas não podem ser enviadas para processos de terceiros que foram interrompidos ou não foram iniciados.

### Plano de Keep Alive

Adicionando uma interface keep-alive para chamada à função de inicialização do aplicativo do processo para garantir o processo vivo.

```java
@Override
public void onCreate() {
super.onCreate();
LamyKeepAliveManager.getInstance().startKeepAlive(this);
}
```

Chame quando quiser sair da função keep-alive

```java
LamyKeepAliveManager.getInstance().stopKeepAlive(this);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://portal-integracao.intelbras.com.br/linha-android/inicio-automatico-da-aplicacao/plano-de-inicio-automatico-da-aplicacao.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
