开发者

Android application packaging

开发者 https://www.devze.com 2023-03-23 12:06 出处:网络
I have two android applications- A and B. I\'m trying to package them as a single unit so that upon installation the system installs both apps. However, I could not find any reliable ans开发者_StackO

I have two android applications- A and B.

I'm trying to package them as a single unit so that upon installation the system installs both apps. However, I could not find any reliable ans开发者_StackOverflow中文版wer till now.

In A's manifest file I added activity tag of B, resulting in error.

Could anyone guide me on how to package two applications as a single unit?

Thanks in advance!


I do not believe this is possible. An APK corresponds to a single AndroidManifest.xml which corresponds to a single Application.

However, if you want mulitple "launchers" or icons, it is possible by exposing multiple Activities by adding IntentFilters to the ones you want (which take the launcher event). However, they are still, technically, a single application.

Update: Here's how to expose multiple Activities. The main activity would have something similar in the AndroidManifest.xml

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Copy-paste this inside the other Activities you want to expose. For example:

<activity 
        android:name="com.example.app.FirstActivity" 
        android:label="@string/first_app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity 
        android:name="com.example.app.SecondActivity" 
        android:label="@string/second_app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号