我的应用程序在启动时移动无法启动 [英] my application not start on BootUp mobile

查看:154
本文介绍了我的应用程序在启动时移动无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我下面的应用程序无法启动我的应用程序,当我打开手机我按照这个像<一个我manifiest文件href=\"http://stackoverflow.com/questions/17168177/how-to-start-my-application-when-ever-mobile-restart-or-turn-on\">how开始我的应用程序时不断移动重启或打开

 &LT;?XML版本=1.0编码=UTF-8&GT?;
 &LT;清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 包=com.example.installedapps22
 安卓版code =1
 机器人:=的versionName1.0&GT; &LT;用途-SDK
    安卓的minSdkVersion =8
    机器人:targetSdkVersion =8/&GT;
    &LT;使用许可权的android:NAME =android.permission.RECEIVE_BOOT_COMPLETED/&GT;
 &lt;应用机器人:图标=@绘制/ cherry_icon机器人:标签=@字符串/ APP_NAME&GT;
    &LT;活动机器人:名字=。MainActivity
              机器人:标签=@字符串/ APP_NAME&GT;
        &所述;意图滤光器&gt;
            &lt;作用机器人:名字=android.intent.action.MAIN/&GT;
            &LT;类机器人:名字=android.intent.category.LAUNCHER/&GT;
        &所述; /意图滤光器&gt;
    &LT; /活性GT;
    &lt;接收机器人:启用=真正的机器人:名字=com.app.reciever.BootU preciever&GT;
  &所述;意图滤光器&gt;
        &lt;作用机器人:名字=android.intent.action.BOOT_COMPLETED/&GT;
        &LT;类机器人:名字=android.intent.category.DEFAULT/&GT;
  &所述; /意图滤光器&gt;
 &LT; /接收器&GT;
  &LT;活动机器人:ListInstalledAppsNAME =&GT; &LT; /活性GT;
  &LT;活动机器人:TabsLayoutActivityNAME = /&GT;
  &LT; /用途&gt;
 &LT; /清单&GT;

类文件

 包com.example.installedapps22;公共类BootU preciever延伸广播接收器
{    @覆盖
    公共无效的onReceive(最终上下文的背景下,意图意图){
        意图I =新意图(背景下,MainActivity.class);
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(ⅰ);
    }
}


解决方案

检查我的这个问题,并提供了答案 - 它们是相关的,并且可以解决你的问题:

即使使用的目的不同的是,安全问题我在下面说明是类似的。


问题可能是你需要运行一次应用程序之前,将在 BOOT_COMPLETED 意图做出回应。

这是一种安全措施。

如果你不运行应用程序,它不会开机启动。试试看吧。

即。


  1. 写的应用程序

  2. 安装的应用程序

  3. 运行APP

  4. 重启手机,检查是否正常工作

this is my manifiest file below my application not start my application when i turn On mobile i follow this like how to start my application when ever mobile restart or turn on

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.example.installedapps22"
 android:versionCode="1"
 android:versionName="1.0" >

 <uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="8" />    
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />   
 <application android:icon="@drawable/cherry_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:enabled="true" android:name="com.app.reciever.BootUpReciever">
  <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
 </receiver>
  <activity android:name=".ListInstalledApps" > </activity> 
  <activity android:name=".TabsLayoutActivity" />
  </application>
 </manifest>

Class File

package com.example.installedapps22;

public class BootUpReciever extends BroadcastReceiver
{

    @Override
    public void onReceive(final Context context, Intent intent) {
        Intent i = new Intent(context, MainActivity.class);  
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i);
    }
}

解决方案

Check this question of mine, and the answer provided - they are related, and might solve your problem:

Even though the intent used is different, the security issue I describe below is similar.


The problem might be that you need to run the application once BEFORE it will respond to the BOOT_COMPLETED intent.

This is a security measure.

If you do not run the application, it will not start on boot. Give it a try.

i.e.

  1. write app
  2. install app
  3. RUN APP
  4. reboot phone to check if it works

这篇关于我的应用程序在启动时移动无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆