【发布时间】:2017-03-22 10:59:27
【问题描述】:
我想在模拟器中使用 Action BOOT_COMPLETED 检查 BROADCAST RECEIVER。
这是我的代码
public class AutoRunService extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
Toast.makeText(UApplication.getInstance(), "Application is ready to open ", Toast.LENGTH_SHORT).show();
myFunciton(context);
}
}
public void myFunciton(Context context) {
}
}
<receiver
android:name=".AutoRunService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
我正在使用 Windows 10 和 genymotion 模拟器。 有什么方法可以检查模拟器中的广播接收器吗?如何重新启动模拟器以检查该接收器?有没有直接的命令?
提前致谢。
【问题讨论】:
标签: android android-emulator genymotion android-broadcastreceiver reboot