When I build a single apk and I try to install it on the device two apps are shown instead of one, but neither app opens. What is the cause of this? I just want one only.
No, there's still just one app but you need to tweak your Manifest file as apparently you have two activities with
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Remove this filter from activity you do not want to be your entry point.
Related
So I'm learning android programming and everything is going well, until I came to this problem.
I'm using android studio and transfer my app to my phone, this has worked well until now. The app start automatically and works fine, but when I go back to the home screen on my phone the app is not there, it's not saved on my phone. The problems is the same when using the emulator.
anyone know this problem?
Most probably you need a line in the android manifest that tells us that the app will appear in the launcher.
Check this link out :
https://groups.google.com/forum/m/#!topic/android-developers/csokbhepUG0
In your manifest, add this to your main activity:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You probably already have the MAIN action on the activity, you just need to add the category <category android:name="android.intent.category.LAUNCHER" /> so that it shows up on the launcher.
Is it possible to bundle several mobile apps into a single download? So a person can install the bundled apps, then have several new apps available on their phone.
For example, a bundle of iOS apps, or a bundle of Android apps?
For iOS you can't do it. I tried to place multiple application in one ipa (which is just zip), but it will recognized just one of them.
Downloading additional content is also prohibited on iOS.
However, if you distribute application over the air, you can create a file (I don't remember exactly how it's called) which will have multiple asset's in it (multiple ipa's).
For Android, pablisco and user2115660 pretty much covered it.
You can't do that as it is. What wou can do is add an extra Activity with a CATEGORY_HOME in the intent filter and it will appear as a separate app on Android's launcher:
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
You would have to change the icon and label properties of the activity for it to have a different icon and name as well :)
UPDATE:
The format I was using for the intent filter wasn't correct. This is how the activities would have to be declared inside the application tag in the manifest:
<activity android:name=".MainActivity"
android:icon="#drawable/main_icon"
android:label="#string/main_app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SecondaryActivity"
android:icon="#drawable/secondary_icon"
android:label="#string/secondary_app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
If you want to include an Activity inside a library project you will have include the full path to that given Activity.
One interesting approach would be to create both apps like library projects and then compound them into one. Bear in mind that you can't package library projects into apk so you would have to do separate projects if you want to create individual products.
Here is some info about library projects: http://www.vogella.com/articles/AndroidLibraryProjects/article.html
I saw one app that after instillation started downloading apk's and installing them.
For iOS, outside of the jailbreak world, of which I am not overly familiar with, no.
This is a question concerning android applications with two different .apks (or two apps contained in the one .apk file)
I have two apps which do completely different things but are related, say one is a standard user app and one is an admin app. But a user can be both a user and an admin. I am wondering is it possible for me to create one .apk file that installs two applications to the phone? And how would I got about this?
Thanks,
Matt
You can have two activity elements in the same manifest file, which have both the intent filter with action=MAIN and category=LAUNCHER. Further, you have also to use the attribute "android:taskAffinity" for both activity elements (see also here):
<application android:allowBackup="true"
android:icon="#drawable/main_icon"
android:label="#string/main_name"
android:theme="#style/AppTheme" >
<activity android:name="com.foobar.MyActivity2"
android:taskAffinity="com.foobar.MyActivity2"
android:icon="#drawable/icon1"
android:label="#string/name1" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.foobar.MyActivity2"
android:taskAffinity="com.foobar.MyActivity2"
android:icon="#drawable/icon1"
android:label="#string/name2" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
When the APK file with this manifest is installed on a device, then it will create two icons on the homescreen. The titles of these icons will be taken from the attributes android:label, and the icons will be taken from the attributes android:icon. In the list of apps under "Settings | Apps" you will see the name & icon defined by the attributes of the application tag. When you choose "uninstall" for this entry in the list of apps, then both "apps" will be removed from the device.
It depends on your definition of "application". You cannot install 2 applications if you use the more official definition, as you can have only 1 <application> in your manifest.xml
You can define several activities in your manifest.xml, and they can do seperate things, so in that way YOU CAN have 2 things a person might describe as "application" in one APK
Just define multiple activities and use those could be defined as an option, but it depends on your definition of 'application', but in this case I'd say it would work
Yes, you can install multiple apps by just installing one app.
In Manifest.xml
Project Structure:
You should either build 2 APKs are use APK Expansion Files.
Btw, this is a security measure.
No.
what you can do is to check if the second app is already installed, and if the answer is no, you can prompt the request to install the second app using this post.
Is it possible to bundle an app and the app settings into one apk file? so I can change the app settings from the "App settings"
Thanks
If these two apps have no overlaps, you only need to merge the AndroidManifest.xml, res and src folders.
Keep two activities with the following intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
will make you have two launch entrances in Launcher.
In fact, it's one app with one apk. But since have two launchable activities, user will feel like they have installed two apps with one apk.
Found answer on another question
i have published android app but not appearing in android market.i m using android 2.2 and i have tried in samsung galaxy that is not showing my application so just give me some idea to fix this problem.
this is my manifest.xml file:
<activity android:name=".Full"
android:screenOrientation="landscape"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".Short"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
</application>
Please help me..
The android market appears to be experiencing some problems for many isers currently. Many people are unable to download anything from it. I would imagine that your problem is related to this. And i would guess it will be fixed tomorrow if not in a few hours or less.
Check your developer console for the market. Make sure that you see your app in the console and that it say "published" on the right. If that's all there, click on the app name to see the details and then expand the section on market filtering. It might explain there why your app may not be showing up on your galaxy tab.
Or, like #Tim says, you may just need to be patient. The market infrastructure for developers still has quite a few warts.