这是我的 Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.testapp"
android:versionCode="1"
android:versionName="Pm61" >
<uses-sdk android:minSdkVersion="15"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<supports-screens android:anyDensity="true" />
<application android:label="@string/app_name" android:debuggable="true" android:largeHeap="true">
<activity android:name="com.abc.testapp.MainClass" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent" android:hardwareAccelerated="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
.
.
.
.
.
.
<activity android:name="com.abc.testapp.BootLoad"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
</activity>
<activity android:name="com.abc.testapp.Rxmain" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" android:launchMode="singleTask">
</activity>
<receiver android:name="com.abc.testapp.MyReceiver" android:enabled="true">
<intent-filter android:priority="500">
<action android:name= "android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MEDIA_MOUNTED"/>
<data android:scheme="file" />
</intent-filter>
</receiver>
</application>
</manifest>
这是我的 MyReceiver 广播类
package com.abc.testapp;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
public class MyReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
String action = intent.getAction();
if(Intent.ACTION_MEDIA_MOUNTED.equals(action))
{
Log.d("MYReceiver","Mounting Successfull");
Intent serviceActivity = new Intent(context, Rxmain.class);
serviceActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(serviceActivity);
}
if(Intent.ACTION_BOOT_COMPLETED.equals(action))
{
Log.d("MYReceiver","Boot Successfull");
Intent serviceActivity = new Intent(context, BootLoad.class);
serviceActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(serviceActivity);
}
}
}
我的设备是独立设备,只有我的应用程序会启动。
我希望在启动完成时启动 BootLoad 活动,并在 MEDIA_MOUNTED 之后启动 Rxmain Activity。
但是我的 bootLoad 活动没有到来
所以我对此有一些疑问:
- 它有时工作但有时不工作?
2.Intent-filter中的这个优先级是什么?
这个数据方案是做什么的?
我在做什么正确与否?
请建议我