【问题标题】:how can I launch a first time installation project?如何启动首次安装项目?
【发布时间】:2016-10-06 12:05:53
【问题描述】:

我有一个第一次安装的 android 项目。 它与我的公司协议页面有关。它出现在 google 协议页面之后。

我尝试了一些技术来做到这一点。例如,我将其设置为系统应用程序。但是,在备份和重置操作时会被清除。

有人知道怎么运行吗?

在 AndroidManifest.xml 上

<application
        android:theme="@android:style/Theme.NoTitleBar"
        android:allowBackup="true"
        android:icon="@drawable/launcher"
        android:label="@string/appname" >
        <activity
            android:name="xxxagreement.MainActivity"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
            android:label="@string/app_name" 
        android:screenOrientation="portrait" >
            <intent-filter android:priority="3">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>

在 MainActivity.java 上

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main); 
    }

@Override
protected void onResume() {
    Intent i = new Intent();
    i.setAction(AGREEGATE_STARTED);
    sendBroadcast(i); 
    TextView t = (TextView)findViewById(R.id.textView1);
    t.setSelected(true);
    ...
    super.onResume();
    } 

事件日志打印:

会话“应用程序”:启动活动时出错

【问题讨论】:

    标签: java android android-manifest launch


    【解决方案1】:

    您的应用程序没有任何启动器活动。替换这些行

    <category android:name="android.intent.category.HOME" />
    <category android:name="android.intent.category.DEFAULT" />
    

    <category android:name="android.intent.category.LAUNCHER" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-28
      相关资源
      最近更新 更多