For security reasons, a broadcast receiver will not activate until after
the user has started an activity, could this be your issue?  I notice there
is no activity in the manifest segment you posted.

On Nov 17, 2016 12:26 PM, "MrEdusi" <[email protected]> wrote:

> My BroadcastReceiver will not start I will post the code below if someone
> can point me the error thank you<uses-permission 
> android:name="android.permission.INTERNET"
> />
>
>
> <receiver
>
>     android:enabled="true"
>     android:name="BroadcastReceiver"
>     android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
>
>
>     <intent-filter>
>
>         <action android:name="android.intent.action.BOOT_COMPLETED" />
>
>
>     </intent-filter>
>
> </receiver>
>
> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
>
> <service android:name="ComandosDoControle">
> </service>
>
>
>
>
> public class BroadcastReceiver extends android.content.BroadcastReceiver {
>
>     @Override
>     public void onReceive(Context context, Intent intent) {
>         Intent i = new Intent(context, ComandosDoControle.class);
>         Log.d("Iniciado....","BroadcastReceiver");
>         context.startService(i);
>
>     }
>
>
>
> }
>
>
> ublic class ComandosDoControle extends Service
>         implements View.OnKeyListener{
>
>     public int onStartComand(Intent intent, int flags, int startid){
>         return Service.START_STICKY;
>     }
>
>
>     //ACESSO A OUTROS APPS
>     @Override
>     public IBinder onBind(Intent intent) {
>         return null;
>     }
>
>     @Override
>     public boolean onKey(View v, final int keyCode, final KeyEvent event) {
>
>         new Thread(new Runnable() {
>
>             public void run() {
>
>                 if (keyCode == event.KEYCODE_ENTER) {
>
>                     Log.d("Clicado....","ComandosDoControle");
>
>                   //  Toast.makeText(getApplicationContext(), "Botão do 
> controle pegou!", Toast.LENGTH_LONG).show();
>
>                 }else{
>
>                    // Toast.makeText(getApplicationContext(), "Botão do 
> controle não pegou!", Toast.LENGTH_LONG).show();
>                 }
>             }
>         }).start();
>
>         return true;
>
>     }
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/android-developers/1f923fba-c9be-4272-9864-
> 5b087a1c2020%40googlegroups.com
> <https://groups.google.com/d/msgid/android-developers/1f923fba-c9be-4272-9864-5b087a1c2020%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CABfabRhtxcKTdT0k8eLTaVJefZrE86qsbAnxghzbt29XAceA3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to