1

수신자가 Android 6.0 Marshmallow으로 작동하지 않습니다.Android 6.0 브로드 캐스트 수신기가 수신되지 않습니다. BOOT_COMPLETE

내가 ADB 쉘을 통해 방송을 전송하고

, 아래 참조 : 응용 프로그램이 열려 있다면

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED이 을받은 앱 말 : 작업을!

그러나 응용 프로그램이 열려 있지 않으면 아무 것도 반환하지 않았습니다.

내 코드는 여기에 있습니다.

의 AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.berate.rebootreceiverfromb3r0"> 
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" android:protectionLevel="signature|development"></uses-permission> 
    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:supportsRtl="true" 
     android:theme="@style/AppTheme"> 
     <activity android:name=".MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 


     </activity> 

     <receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver"> 
       <intent-filter> 
        <category android:name="android.intent.category.DEFAULT"></category> 
        <action android:name="android.intent.action.BOOT_COMPLETED" /> 
        <action android:name="android.intent.action.QUICKBOOT_POWERON" /> 
       </intent-filter> 
      </receiver> 
    </application> 

</manifest> 

Receiver.Java;

public class Yakala_Receiver extends BroadcastReceiver { 

    @Override 
    public void onReceive(Context context, Intent intent) { 
     Toast.makeText(context,"i got it ",Toast.LENGTH_SHORT).show(); 
    } 
} 

편집 : 흥미로운 정보가 있습니다. 내 코드는 samsung (Android 6.0) 기기에서 작동합니다. 하지만 내 (안드로이드 6.0) 장치 나에게

+0

수신자 태그에 android : enabled = "true"android : exported = "true"를 추가하십시오. – user5195185

+0

http://stackoverflow.com/questions/12274997/why-broadcastreceiver-works-even-when-app-is-in-background 체크 아웃 – nuriselcuk

+0

왜 android : protectionLevel을 지정 하시겠습니까? 이것은 권한을 사용할 때가 아니라 권한을 만들 때입니다. – JoxTraex

답변

1

도움이되기를 바랍니다, 새로운 안드로이드 기기 보안 응용 프로그램에서이 태만. 이 앱은 자동 시작 모드를 잠그는 경우가 있습니다.

+0

어떻게 수리하셨습니까? – rsc

+0

휴대 전화에 보안 응용 프로그램이 있습니다. 나는 보안 애플리케이션과 문제없이 작동하는 코드를 제거했다. 휴대 전화에서 타사 보안 앱을 검색해야합니다. –

+0

확인. 답변 감사합니다. – rsc

3

변화를 응답하지 않는이

<receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver" android:enabled="true" android:exported="true"> 
      <intent-filter> 
       <category android:name="android.intent.category.DEFAULT"></category> 
       <action android:name="android.intent.action.BOOT_COMPLETED" /> 
       <action android:name="android.intent.action.QUICKBOOT_POWERON" /> 
      </intent-filter> 
     </receiver> 

<receiver android:name="com.example.berate.rebootreceiverfromb3r0.Yakala_Receiver"> 
      <intent-filter> 
       <category android:name="android.intent.category.DEFAULT"></category> 
       <action android:name="android.intent.action.BOOT_COMPLETED" /> 
       <action android:name="android.intent.action.QUICKBOOT_POWERON" /> 
      </intent-filter> 
     </receiver> 

이 내가 고정

+0

나는 당신의 코드를 시도하지만 작동하지 않는다 : ( –

+0

브로드 캐스트를 수신하려면 앱을 한 번 열어야한다. 자세한 내용은이 정보를 확인한다. -> http://stackoverflow.com/a/19856367/1129332 – madroid

+0

답장을 보내 주셔서 감사합니다. 내 문제는 여기에, 메신저 응용 프로그램을 열고 메신저를 제거하지 않습니다. 메신저 응용 프로그램을 종료하고 방송을 보내려고. 그리고 응답이 없습니다. –