0
我有这个设备管理员priviledge应用程序与一些广播公司(我正在适当的时间注册和注册!),问题是我的应用程序启动设备启动,我不没有任何意图过滤这个意图,并使我的应用程序开始! ,请参阅AndroidManifest.xml中如下:应用程序不应该启动在启动但开始
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.winacro.xyz"
android:versionCode="1"
android:versionName="1.0" >
<!--uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /-->
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Fullscreen" >
<activity
android:name="com.winacro.xyz.SplashScreen"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Fullscreen" >
</activity>
<activity
android:name="com.winacro.xyz.Boot"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.winacro.xyz.Xyz"
android:screenOrientation="portrait"
android:theme="@style/Fullscreen"
android:label="@string/app_name" />
<activity
android:name="com.winacro.xyz.Locked"
android:screenOrientation="portrait"
android:theme="@style/Fullscreen"
android:label="@string/app_name" />
<service
android:name="com.winacro.xyz.xyzService"
android:enabled="true" >
</service>
<receiver android:name="com.winacro.xyz.MyBroadcastReceiver" >
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_DETACHED"
android:resource="@xml/device_filter" />
</receiver>
<receiver android:name="com.winacro.xyz.activateSERVICE" >
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data
android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</receiver>
<!-- Device Admin Receiver -->
<receiver
android:name="com.winacro.xyz.DeviceAdminR"
android:permission="android.permission.BIND_DEVICE_ADMIN" >
<intent-filter>
<!-- This action is required -->
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
<!-- This is required this receiver to become device admin component. -->
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/policies" />
</receiver>
</application>
正如你可以看到我已经在项值清单中评论所以它应该路径引导事件到我的但是我的应用从activateSERVICE开始的.java肚里如下:
public class activateSERVICE extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Boolean Set True", Toast.LENGTH_SHORT).show();
//Intent startActSerIntent = new Intent(context, Boot.class);
Intent i = new Intent();
i.setClassName("com.winacro.xyz", "com.winacro.xyz.Boot");
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Intent startService = new Intent(context, xyzService.class);
context.startService(startService);
context.startActivity(i);
//context.startActivity(startActSerIntent);
xyzService.USBpluggedIn = true;
}
}
请告诉我为什么我的应用程序启动(我证实,我的应用程序从activateSERVI开始? CE是因为只有这个代码设置变量USBpluggedIn = true的原因;只有当这个设置,我的应用程序启动xyzService.class这是开始。 )
即使没有连接任何USB设备,它仍会弹出,但解决方案并非如此简单。 – Naaz 2014-10-05 09:26:32
你看过日志吗?并检查传递给您的接收器的意图,这应该包含什么触发广播的信息。 – Okas 2014-10-05 09:28:28
雅我做到了,但也许我会再次注意日志,问题是,这种情况发生在手机启动时,应用程序在开机时悄然打开,到那时候ADB未激活,因此无法使用LOGCAT! – Naaz 2014-10-05 09:38:56