我想在开始时使用android.intent.action.BOOT_COMPLETED来启动我的服务,但我没有在nexus 4中收到它的广播。它的三星手机工作正常。android.intent.action.BOOT_COMPLETED不适用于nexus 4
<receiver android:name=".BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
而且我已经给权限
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
接收文件:
public class BootReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "boot completed", Toast.LENGTH_SHORT).show();
Log.d("Boot Completed", "Boot completed received");
}
}
我无法接收BOOT_COMPLETED意图。
它与三星模型的工作良好,但不适用于NEXUS 4. 我使用ANDROID STUDIO。 请帮助。
您从您的第一个接收器标记 – JAPK
的末尾缺少'>'它的不精确的代码伙伴。它的确在那里。相同的apk与samsung一起工作,但不与nexus 4 –