博主信息
弘德誉曦的博客
博文
135
粉丝
1
评论
0
访问量
113601
积分:1
P豆:427

html5 + app 重启

2019年11月10日 16:09:53阅读数:653博客 / 弘德誉曦的博客/ Android
  1. <!-- 开机自动启动应用 -->
  2. <receiver android:name="io.dcloud.myself.BootBroadcastReceiver">
  3. <intent-filter>
  4. <action android:name="android.intent.action.BOOT_COMPLETED" />
  5. <category android:name="android.intent.category.LAUNCHER"></category>
  6. </intent-filter>
  7. </receiver>
  8. <!-- u盘插入/拔出得启应用 -->
  9. <receiver android:name="io.dcloud.myself.UsbBroadcastReceiver">
  10. <intent-filter>
  11. <action android:name="android.intent.action.MEDIA_MOUNTED"/>
  12. <action android:name="android.intent.action.MEDIA_UNMOUNTED"/>
  13. <action android:name="android.intent.action.MEDIA_REMOVED"/>
  14. <category android:name="android.intent.category.LAUNCHER"></category>
  15. <data android:scheme="file"/>
  16. </intent-filter>
  17. </receiver>
  1. import android.content.BroadcastReceiver;
  2. import android.content.Context;
  3. import android.content.Intent;
  4. import android.util.Log;
  5. import io.dcloud.PandoraEntry;
  6. public class BootBroadcastReceiver extends BroadcastReceiver {
  7. static final String action_boot="android.intent.action.BOOT_COMPLETED";
  8. @Override
  9. public void onReceive(Context context, Intent intent) {
  10. Log.d("============", intent.getAction());
  11. String action = intent.getAction();
  12. if (action.equals(action_boot)){
  13. // 注意H5+SDK的Main Activity为PandoraEntry(见AndroidMainfest.xml)
  14. Intent bootMainIntent = new Intent(context, PandoraEntry.class);
  15. // 这里必须为FLAG_ACTIVITY_NEW_TASK
  16. bootMainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  17. context.startActivity(bootMainIntent);
  18. }
  19. }
  20. }
  21. import android.content.BroadcastReceiver;
  22. import android.content.Context;
  23. import android.content.Intent;
  24. import android.util.Log;
  25. import io.dcloud.PandoraEntry;
  26. public class UsbBroadcastReceiver extends BroadcastReceiver {
  27. static final String action_media_unmounted="android.intent.action.MEDIA_UNMOUNTED";
  28. static final String action_media_removed="android.intent.action.MEDIA_REMOVED";
  29. @Override
  30. public void onReceive(Context context, Intent intent) {
  31. Log.d("============", intent.getAction());
  32. String action = intent.getAction();
  33. if(action.equals(action_media_unmounted) || action.equals(action_media_removed)){
  34. // 注意H5+SDK的Main Activity为PandoraEntry(见AndroidMainfest.xml)
  35. Intent bootMainIntent = new Intent(context, PandoraEntry.class);
  36. // 这里必须为FLAG_ACTIVITY_NEW_TASK
  37. bootMainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  38. context.startActivity(bootMainIntent);
  39. android.os.Process.killProcess(android.os.Process.myPid());
  40. }
  41. }
  42. }

版权申明:本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!

全部评论

文明上网理性发言,请遵守新闻评论服务协议

条评论
  • 区别:1、原生态app如比较正规,html5实现的功能有限,只能实现一些轻型的交互场景,而app则可以完美解决。
    html5 app开发框架有:1、jquery mobile;2、bootstrap;3、ionic;4、Mobile Angular UI;5、Intel XDK;6、Appcelerator Titanium
    linuxmysql的方法:1、直接使用“service mysqld restart”或“service mysql restart”命令;2、使用“/etc/init.d/mysqld restart

    2021-03-30

    204

    php是可以的,其方法:首先打开终端命令窗口;然后通过命令“service php-fpm restart”来PHP服务即可。
    Linux中的命令有: 1、“shutdown -r now”命令,停止系统服务后;2、“init 1”命令;3、“reboot”命令,立即;4、“poweroff”命令;5、“halt
    linux下redis的方法:执行【systemctl restart redis.service】进行
    win10命令的方法是:首先使用快捷键【win+R】打开运行框;然后输入命令【shutdown -r】,并回车;最后等待电脑即可。
    ubuntu命令是什么“reboot”。具体方法是:首先连接“ubuntu shell”,然后在窗口里输入“reboot”,最后按下键盘上的“回车键”进行即可。
    下面由centos教程栏目给大家介绍centos7的网卡方法,希望对需要的朋友有所帮助!
    电脑按“Ctrl+Alt+Delete”键,具体方法:首先按“Ctrl+Alt+Delete”键,然后选择右下角的“关机”按钮隔壁的小箭头,点击“”选项即可。
    ssh服务的命令是:1、通过【service sshd restart】命令ssh服务;2、通过【systemctl restart sshd.service】命令ssh服务。
    ubuntu网络服务的方法是:1、使用命令【service network-manager restart】来网络服务;2、使用命令【sudo ifdown -a && sudo
    动命令:【./nginx -c /usr/local/nginx/nginx/conf/nginx.conf】。命令:【./nginx -s reload】。
    修改php.ini后php-fpm的方法:1、打开“php-fpm.pid”并获取id;2、执行命令“kill -USR2 42890”;3、php-fpm即可。
    linux下nginx命令为:“kill -HUP nginx的进程号”。方法:首先查找当前nginx进程号,然后输入命令“kill -HUP 进程号”即可实现nginx服务。
    ssh服务的命令是:1、通过【service sshd restart】命令ssh服务;2、通过【systemctl restart sshd.service】命令ssh服务。
    linux修改php.ini并php-fpm的方法:首先打开“php-fpm.pid”并获取id;然后直接执行命令“kill -USR2 42890”;最后关闭“php-fpm”并即可。
    windows的网卡的方法:1、以管理员身份运行命令提示符;2、执行命令禁用网卡;3、执行命令【netsh interface set interface "本地连接" enabled
    方法:首先按“win+r”,执行“msconfig”,勾选“选择器动”,取消选择“加载动项”;然后“服务”选项卡勾选“取消所有Microsoft服务”和“全部禁用”;最后点击“动”-“任务管理器”
    win10一直收集错误的解决方法:1、右键点击开始菜单,打开电源选项;2、点击【选择电源按钮功能】、【更改当前不可用的设置】;3、取消勾选【用快速动】,电脑。