0

在 kitkat 4.4.4 设备中启动后它不起作用..请帮助..即使我在安装后运行应用程序一次但没有启动,然后启动,但结果相同。AAndroidManifes.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"

package="com.example.snaha.reminder1" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE"/>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <receiver android:process=":remote" android:name="AlarmReceiver"></receiver>
    <receiver
     android:name="com.example.snaha.reminder1.onBootComplete"
        android:enabled="true"
        android:exported="true"
        android:label="onBootComplete">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

这是我的 onBootComplete 课程

public class onBootComplete extends BroadcastReceiver {

    public void onReceive(Context content,Intent intent) {
        PendingIntent mAlarmSender=null;
        Toast.makeText(context, "Alarm Set"+"OnBoot",       Toast.LENGTH_SHORT).show();
        String dose=null;
        String category=null;

    }
}
4

2 回答 2

2

解决了这个问题,我在 SD 卡上安装了应用程序,它在 Boot Receiver 上支持 dsnt!,我将它重新安装到手机内存中,它工作了!:)

于 2015-04-25T18:42:28.487 回答
1

在接收者的意图过滤器中添加以下内容

  <intent-filter>
      <action android:name="android.intent.action.BOOT_COMPLETED" />
      <action android:name="android.intent.action.QUICKBOOT_POWERON" />
 </intent-filter>
于 2015-04-24T16:54:55.637 回答