当前位置: 编程技术>移动开发
本页文章导读:
▪andriod编译环境筹建 andriod编译环境搭建
Andriod编译环境一、 判断机器字长支持64的CPU如下:在bios中设置虚拟技术将Inter Virtualization Technology设置为ENABLE 二、下载VMware和ubuntu的安装包下载VMware-workstation-fu.........
▪ Notification跟NotificationManager Notification和NotificationManager
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://liangruijun.blog.51cto.com/3061169/657502 Notific.........
▪ 老掉牙施教你山寨360手机安全卫士,优化大师,QQ手机管家,金山卫士的一些功能(1) 老施教你山寨360手机安全卫士,优化大师,QQ手机管家,金山卫士的一些功能(1)
第一次写博客。有不到之处。请指教。。。。(心情不好。求妹紫安慰)
今天老施写的是实现一个禁止掉手.........
[1]andriod编译环境筹建
来源: 互联网 发布时间: 2014-02-18
andriod编译环境搭建
Andriod编译环境一、 判断机器字长
支持64的CPU如下:
在bios中设置虚拟技术
将Inter Virtualization Technology设置为ENABLE
二、下载VMware和ubuntu的安装包
下载VMware-workstation-full-7.1.4-385536.zip和 ubuntu系统通过光盘或者iso,但是必须安装64位的
VMware-workstation-full-7.1.4-385536.zip 可用的注册码
YY1E0-A6E51-M892Y-FGPZZ-XC0TF
CC542-2QF41-M847P-EZPQT-Q3AU6
FA18H-4ZZ15-M805P-6MN5G-ZY0G0
UF1W2-DCXDK-48ENY-TDNGG-MG0V2
YU3W2-6RY92-M89FP-KPQQT-X3RE2
VA34H-DWWD6-08ELZ-3XQ7X-PAK90
三、安装虚拟机以及操作系统
安装完毕后运行
sudo apt-get update
sudo apt-get upgrade
四、安装MTK的编译环境设置
apt-get update
apt-get install flex bison gperf build-essential curl zlib1g-dev g++-multilib g++-4.4-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z1-dev mingw32 vim wine
rm /bin/sh
ln -s /bin/bash /bin/sh
五、安装JDK
下载jdk-6u26-linux-x64.bin,拷贝到/opt下面执行以下命令
chmod a+x jdk-6u26-linux-x64.bin
./jdk-6u26-linux-x64.bin
六、解压代码包
tar xvf ALPSGBFDD2MPV1_*******_GB_GPL.tar.gz
cat ALPSGBFDD2MPV1_*******_GB_INHOUSE.tar.gz* | tar zxf -
七、修改MTK配置文件mbldenv.sh
JAVA_HOME=/opt/jdk1.6.0_26
ANDROID_JAVA_HOME=/opt/jdk1.6.0_26
PATH=/opt/jdk1.6.0_26/bin:/mnt/hgfs/SharedFolder/mtk6573/alps/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
将$PATH的环境变量添加到根目录下面的.profile中
即/home/xxxx/.profile下
八、编译
#source mbldenv.sh
#./makeMtk **********gb new
九. 细节
内存要求设置在2G以上,虚拟机硬盘分区至少20G
把机器的时间日期设对
Linux是大小写敏感的
十、常用编译命令
./makeMtk listp列出所有可用的项目
./makeMtk new 全编译
Andriod编译环境一、 判断机器字长
支持64的CPU如下:
在bios中设置虚拟技术
将Inter Virtualization Technology设置为ENABLE
二、下载VMware和ubuntu的安装包
下载VMware-workstation-full-7.1.4-385536.zip和 ubuntu系统通过光盘或者iso,但是必须安装64位的
VMware-workstation-full-7.1.4-385536.zip 可用的注册码
YY1E0-A6E51-M892Y-FGPZZ-XC0TF
CC542-2QF41-M847P-EZPQT-Q3AU6
FA18H-4ZZ15-M805P-6MN5G-ZY0G0
UF1W2-DCXDK-48ENY-TDNGG-MG0V2
YU3W2-6RY92-M89FP-KPQQT-X3RE2
VA34H-DWWD6-08ELZ-3XQ7X-PAK90
三、安装虚拟机以及操作系统
安装完毕后运行
sudo apt-get update
sudo apt-get upgrade
四、安装MTK的编译环境设置
apt-get update
apt-get install flex bison gperf build-essential curl zlib1g-dev g++-multilib g++-4.4-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z1-dev mingw32 vim wine
rm /bin/sh
ln -s /bin/bash /bin/sh
五、安装JDK
下载jdk-6u26-linux-x64.bin,拷贝到/opt下面执行以下命令
chmod a+x jdk-6u26-linux-x64.bin
./jdk-6u26-linux-x64.bin
六、解压代码包
tar xvf ALPSGBFDD2MPV1_*******_GB_GPL.tar.gz
cat ALPSGBFDD2MPV1_*******_GB_INHOUSE.tar.gz* | tar zxf -
七、修改MTK配置文件mbldenv.sh
JAVA_HOME=/opt/jdk1.6.0_26
ANDROID_JAVA_HOME=/opt/jdk1.6.0_26
PATH=/opt/jdk1.6.0_26/bin:/mnt/hgfs/SharedFolder/mtk6573/alps/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
将$PATH的环境变量添加到根目录下面的.profile中
即/home/xxxx/.profile下
八、编译
#source mbldenv.sh
#./makeMtk **********gb new
九. 细节
内存要求设置在2G以上,虚拟机硬盘分区至少20G
把机器的时间日期设对
Linux是大小写敏感的
十、常用编译命令
./makeMtk listp列出所有可用的项目
./makeMtk new 全编译
[2] Notification跟NotificationManager
来源: 互联网 发布时间: 2014-02-18
Notification和NotificationManager
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://liangruijun.blog.51cto.com/3061169/657502
Notification和NotificationManager操作相对比较简单,一般获取系统级的服务NotificationManager,然后实例化Notification,设置它的属性,通过NotificationManager发出通知就可以了。基本步骤如下:
1.获取NotificationManager
String service = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager =(NotificationManager)getSystemService(service);
2.实例化Notification对象
//实例化Notification
Notification notification = new Notification();
3.设置Notification的属性
// 设置显示图标,该图标会在状态栏显示
int icon = notification.icon = R.drawable.happy;
// 设置显示提示信息,该信息也在状态栏显示
String tickerText = "测试Notification";
// 显示时间
long when = System.currentTimeMillis(); notification.icon = icon;
notification.tickerText = tickerText;
notification.when = when;
//也可以这样设置
Notification notification_2=new Notification(icon,tickerText,when)
调用setLatestEventInfo()方法在视图中设置图标和时间。
// 实例化Intent
Intent intent = new Intent(MainActivity.this, MainActivity.class);
// 获得PendingIntent
PendingIntent pIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
// 设置事件信息
notification.setLatestEventInfo(MainActivity.this, " Title", "Content", pIntent);
4.发出通知
//Notification标示ID
private static final int ID = 1;
//发出通知
mNotificationManager.notify(ID, n);
下面是具体的例子,在这个例子里定义了一个MainActivity发出广播通知,定义一个MyReceiver类继承Broadcasts接受通知,当接收完通知之后,启动一个SecondActivity,在SecondActivity类中通过Notification和NotificationManager来可视化显示广播通知。具体的步骤如下:
MainActivity.java
package com.android.notification;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
// 声明Button
private Button btn;
// 定义Broadcast Receiver action
private static final String MY_ACTION = "com.android.notification.MY_ACTION";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 设置当前布局视图
setContentView(R.layout.main);
// 实例化Button
btn = (Button)findViewById(R.id.Button1);
// 添加事件监听器
btn.setOnClickListener(listener);
}
// 创建事件监听器
private OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
// 实例化Intent
Intent intent = new Intent();
// 设置Intent action属性
intent.setAction(MY_ACTION);
// 发起广播
sendBroadcast(intent);
}
};
}
MyReceiver.java
package com.android.notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MyReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// 实例化Intent
Intent i = new Intent();
// 在新的任务中启动Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 设置Intent启动的组件名称
i.setClass(context, SecondActivity.class);
// 启动Activity显示通知
context.startActivity(i);
}
}
SecondActivity.java
package com.android.notification;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class SecondActivity extends Activity {
// 声明按钮
private Button cancelBtn;
// 声明Notification
private Notification notification ;
// 声明NotificationManager
private NotificationManager mNotification;
// Notification标示ID
private static final int ID = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second);
// 实例化按钮
cancelBtn = (Button)findViewById(R.id.cancelButton2);
// 获得NotificationManager实例
String service = NOTIFICATION_SERVICE;
mNotification = (NotificationManager)getSystemService(service);
// 实例化Notification
notification = new Notification();
// 设置显示图标,该图标会在状态栏显示
int icon = notification.icon = android.R.drawable.stat_notify_chat;
// 设置显示提示信息,该信息也会在状态栏显示
String tickerText = "Test Notification";
// 显示时间
long when = System.currentTimeMillis();
notification.icon = icon;
notification.tickerText = tickerText;
notification.when = when;
// 实例化Intent
Intent intent = new Intent(this, MainActivity.class);
// 获得PendingIntent
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
// 设置事件信息
notification.setLatestEventInfo(this, "消息", "Hello Android", pi);
// 发出通知
mNotification.notify(ID, notification);
// 为按钮添加监听器
cancelBtn.setOnClickListener(cancelListener);
}
// 取消通知监听器
private OnClickListener cancelListener = new OnClickListener() {
@Override
public void onClick(View v) {
// 取消通知
mNotification.cancel(ID);
}
};
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:text="发出广播通知"
android:id="@+id/Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
second.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:text="显示通知界面"
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:text="取消通知"
android:id="@+id/cancelButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
在AndroidManifest.xml文件中16~21加入对receiver,SecondActivity的声明
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.notification"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<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>
<receiver android:name="MyReceiver">
<intent-filter>
<action android:name="com.android.notification.MY_ACTION"/>
</intent-filter>
</receiver>
<activity android:name="SecondActivity"/>
</application>
</manifest>
效果图:
Notification丰富的提示方式:
声音提醒
·使用默认声音
notification.defaults |= Notification.DEFAULT_SOUND;
·使用自定义声音
notification.sound = Uri.parse("file:///sdcard/notification/ringer.mp3");
·注:如果定义了默认声音,那么自定义声音将被覆盖
振动提醒
·使用默认振动
notification.defaults |= Notification.DEFAULT_VIBRATE;
·使用自定义振动
long[] vibrate = {0,100,200,300};
notification.vibrate = vibrate;
·注:如果定义了默认振动,那么自定义振动将被覆盖
灯光闪烁提醒
·使用默认闪烁
notification.defaults |= Notification.DEFAULT_LIGHTS;
·使用自定义闪烁
notification.ledARGB = 0xff00ff00; // LED灯的颜色,绿灯
notification.ledOnMS = 300; // LED灯显示的毫秒数,300毫秒
notification.ledOffMS = 1000; // LED灯关闭的毫秒数,1000毫秒
notification.flags |= Notification.FLAG_SHOW_LIGHTS; // 必须加上这个标志
更多特性
可以通过 Notification 的相关字段或标志(flags)为提醒设置更多的特性。
·FLAG_AUTO_CANCEL 标志:当提醒被用户点击之后会自动被取消(cancel);
·FLAG_INSISTENT 标志:在用户响应之前会一直重复提醒音;
·FLAG_ONGOING_EVENT 标志:Add this to the flags field to group the notification under
the "Ongoing" title in the Notifications window.
·FLAG_NO_CLEAR 标志:当在提醒栏中点击“清除提醒”按钮时,该提醒将不会被清除;
·number 字段:This value indicates the current number of events represented by the notification.
The appropriate number is overlaid on top of the status bar icon. If you intend to use this
field, then you must start with "1" when the Notification is first created. (If you change
the value from zero to anything greater during an update, the number is not shown.)
·iconLevel 字段:This value indicates the current level of a LevelListDrawable that is used for the notification icon. You can animate the icon in the status bar by changing this value to correlate with the drawable's defined in a LevelListDrawable.
·contentView 字段:To define your own layout for the expanded message, instantiate a
RemoteViews object and pass it to the contentView field of your Notification. Pass the
PendingIntent to the contentIntent field.
本文出自 “IT的点点滴滴” 博客,请务必保留此出处http://liangruijun.blog.51cto.com/3061169/657502
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://liangruijun.blog.51cto.com/3061169/657502
Notification和NotificationManager操作相对比较简单,一般获取系统级的服务NotificationManager,然后实例化Notification,设置它的属性,通过NotificationManager发出通知就可以了。基本步骤如下:
1.获取NotificationManager
String service = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager =(NotificationManager)getSystemService(service);
2.实例化Notification对象
//实例化Notification
Notification notification = new Notification();
3.设置Notification的属性
// 设置显示图标,该图标会在状态栏显示
int icon = notification.icon = R.drawable.happy;
// 设置显示提示信息,该信息也在状态栏显示
String tickerText = "测试Notification";
// 显示时间
long when = System.currentTimeMillis(); notification.icon = icon;
notification.tickerText = tickerText;
notification.when = when;
//也可以这样设置
Notification notification_2=new Notification(icon,tickerText,when)
调用setLatestEventInfo()方法在视图中设置图标和时间。
// 实例化Intent
Intent intent = new Intent(MainActivity.this, MainActivity.class);
// 获得PendingIntent
PendingIntent pIntent = PendingIntent.getActivity(MainActivity.this, 0, intent, 0);
// 设置事件信息
notification.setLatestEventInfo(MainActivity.this, " Title", "Content", pIntent);
4.发出通知
//Notification标示ID
private static final int ID = 1;
//发出通知
mNotificationManager.notify(ID, n);
下面是具体的例子,在这个例子里定义了一个MainActivity发出广播通知,定义一个MyReceiver类继承Broadcasts接受通知,当接收完通知之后,启动一个SecondActivity,在SecondActivity类中通过Notification和NotificationManager来可视化显示广播通知。具体的步骤如下:
MainActivity.java
package com.android.notification;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
// 声明Button
private Button btn;
// 定义Broadcast Receiver action
private static final String MY_ACTION = "com.android.notification.MY_ACTION";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 设置当前布局视图
setContentView(R.layout.main);
// 实例化Button
btn = (Button)findViewById(R.id.Button1);
// 添加事件监听器
btn.setOnClickListener(listener);
}
// 创建事件监听器
private OnClickListener listener = new OnClickListener() {
@Override
public void onClick(View v) {
// 实例化Intent
Intent intent = new Intent();
// 设置Intent action属性
intent.setAction(MY_ACTION);
// 发起广播
sendBroadcast(intent);
}
};
}
MyReceiver.java
package com.android.notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class MyReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// 实例化Intent
Intent i = new Intent();
// 在新的任务中启动Activity
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 设置Intent启动的组件名称
i.setClass(context, SecondActivity.class);
// 启动Activity显示通知
context.startActivity(i);
}
}
SecondActivity.java
package com.android.notification;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class SecondActivity extends Activity {
// 声明按钮
private Button cancelBtn;
// 声明Notification
private Notification notification ;
// 声明NotificationManager
private NotificationManager mNotification;
// Notification标示ID
private static final int ID = 1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.second);
// 实例化按钮
cancelBtn = (Button)findViewById(R.id.cancelButton2);
// 获得NotificationManager实例
String service = NOTIFICATION_SERVICE;
mNotification = (NotificationManager)getSystemService(service);
// 实例化Notification
notification = new Notification();
// 设置显示图标,该图标会在状态栏显示
int icon = notification.icon = android.R.drawable.stat_notify_chat;
// 设置显示提示信息,该信息也会在状态栏显示
String tickerText = "Test Notification";
// 显示时间
long when = System.currentTimeMillis();
notification.icon = icon;
notification.tickerText = tickerText;
notification.when = when;
// 实例化Intent
Intent intent = new Intent(this, MainActivity.class);
// 获得PendingIntent
PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0);
// 设置事件信息
notification.setLatestEventInfo(this, "消息", "Hello Android", pi);
// 发出通知
mNotification.notify(ID, notification);
// 为按钮添加监听器
cancelBtn.setOnClickListener(cancelListener);
}
// 取消通知监听器
private OnClickListener cancelListener = new OnClickListener() {
@Override
public void onClick(View v) {
// 取消通知
mNotification.cancel(ID);
}
};
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:text="发出广播通知"
android:id="@+id/Button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
second.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:text="显示通知界面"
android:id="@+id/TextView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:text="取消通知"
android:id="@+id/cancelButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
在AndroidManifest.xml文件中16~21加入对receiver,SecondActivity的声明
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.notification"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<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>
<receiver android:name="MyReceiver">
<intent-filter>
<action android:name="com.android.notification.MY_ACTION"/>
</intent-filter>
</receiver>
<activity android:name="SecondActivity"/>
</application>
</manifest>
效果图:
Notification丰富的提示方式:
声音提醒
·使用默认声音
notification.defaults |= Notification.DEFAULT_SOUND;
·使用自定义声音
notification.sound = Uri.parse("file:///sdcard/notification/ringer.mp3");
·注:如果定义了默认声音,那么自定义声音将被覆盖
振动提醒
·使用默认振动
notification.defaults |= Notification.DEFAULT_VIBRATE;
·使用自定义振动
long[] vibrate = {0,100,200,300};
notification.vibrate = vibrate;
·注:如果定义了默认振动,那么自定义振动将被覆盖
灯光闪烁提醒
·使用默认闪烁
notification.defaults |= Notification.DEFAULT_LIGHTS;
·使用自定义闪烁
notification.ledARGB = 0xff00ff00; // LED灯的颜色,绿灯
notification.ledOnMS = 300; // LED灯显示的毫秒数,300毫秒
notification.ledOffMS = 1000; // LED灯关闭的毫秒数,1000毫秒
notification.flags |= Notification.FLAG_SHOW_LIGHTS; // 必须加上这个标志
更多特性
可以通过 Notification 的相关字段或标志(flags)为提醒设置更多的特性。
·FLAG_AUTO_CANCEL 标志:当提醒被用户点击之后会自动被取消(cancel);
·FLAG_INSISTENT 标志:在用户响应之前会一直重复提醒音;
·FLAG_ONGOING_EVENT 标志:Add this to the flags field to group the notification under
the "Ongoing" title in the Notifications window.
·FLAG_NO_CLEAR 标志:当在提醒栏中点击“清除提醒”按钮时,该提醒将不会被清除;
·number 字段:This value indicates the current number of events represented by the notification.
The appropriate number is overlaid on top of the status bar icon. If you intend to use this
field, then you must start with "1" when the Notification is first created. (If you change
the value from zero to anything greater during an update, the number is not shown.)
·iconLevel 字段:This value indicates the current level of a LevelListDrawable that is used for the notification icon. You can animate the icon in the status bar by changing this value to correlate with the drawable's defined in a LevelListDrawable.
·contentView 字段:To define your own layout for the expanded message, instantiate a
RemoteViews object and pass it to the contentView field of your Notification. Pass the
PendingIntent to the contentIntent field.
本文出自 “IT的点点滴滴” 博客,请务必保留此出处http://liangruijun.blog.51cto.com/3061169/657502
[3] 老掉牙施教你山寨360手机安全卫士,优化大师,QQ手机管家,金山卫士的一些功能(1)
来源: 互联网 发布时间: 2014-02-18
老施教你山寨360手机安全卫士,优化大师,QQ手机管家,金山卫士的一些功能(1)
第一次写博客。有不到之处。请指教。。。。(心情不好。求妹紫安慰)
今天老施写的是实现一个禁止掉手机开机后自启动程序。就是360.优化大师。qq管家。金山卫士,安全管家的开机加速功能。需求就是这样。
那我们来思考下,要怎么实现?
要实现这个,我们首先想到的是,怎么获取手机上的程序是开机后自启动的。?
据我所知要实现开机后自启动程序,就得实现一个广播接收器来接收开机广播,然后再干我们想干的事,竟然知道了手机开机后自动启动程序的实现原理。那我们是否只需要获取哪些程序实现了开机广播的后就知道哪些程序就是开机后自启动程序,我查了一些资料,发现有这个方法,queryBroadcastReceivers();我通过查看api得知这个方法可以获取到哪些程序实现了接受开机广播的广播
OK。言归正传。终于找了个时间把demo写好了。哎!不容易呀!具体看附件代码。老施截了几个有开机加速功能的软件图
本程序的。
360的。老施一对比。发现数据有点不对。我写的,获取的开机自启程序优化大师多了几个。老施比较迷惑了。难道老施的获取方法不对?求解惑。
最新技术文章: