I have a requirement to do an app to function like this.
Its an android application and it should have 2 launching methods.
One is to proceed the function directly when touching the icon.
Another icon should be there to give the setting to the same app to set the setting the settings of the android application.
Basically the app should work like the screen off and lock app in the market.
How can i achieve these 2 things in one app? When i install the app, i need to have two icons, one to do the functionality directly and other to set the settings of the application.
I believe you are trying to have to separate launchers (icons to start apps) in your app, launching two different activities. This is easily achieved within your manifest. Create two activities, say MainActivity and SettingsActivity and then declare them in manifest as launch-able - with different titles:
<activity
android:name=".MainActivity"
android:label="#string/main_activity_title"
android:icon="#drawable/main_icon">
<intent-filter android:label="#string/main_app_title">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SettingsActivity"
android:label="#string/settings_activity_title"
android:icon="#drawable/settings_icon">
<intent-filter android:label="#string/settings_app_title">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
When your app is installed, there will be two icons created: one to start the MainAcivity and another one to start SettingsActivity.
Related
I want to make my Android application invisible and work through a background task.
This part should work like these two apps, if anyone knows them:
https://www.keeperschildsafety.net/
https://www2.mspy.com/
I already found examples for making the app icon invisible, but I want to go one step further.
This is the site I found that on:
https://readyandroid.wordpress.com/hideunhide-app-icon-programmatically-android/
I also found some explanations that I should delete the <intent-filter>:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
But then I am not able to start my application.
On all other sites I read that this is not possible, but the two examples shown at the top prove that it is actually possible somehow.
I want to start my application once, then hide it and unhide it later.
I already know how to trigger the unhide. The only part that I need is the hiding and unhiding itself.
You need to remove the following line from your AndroidManifest.xml:
<category android:name="android.intent.category.LAUNCHER"/>
This will remove the application from the default launcher. However, you also need to add the following line such that your BroadcastReceiver is not completely ignored:
<category android:name="android.intent.category.DEFAULT"/>
You should NOT remove the line below - it is used to specify which Activity should launch first when your app is opened:
<action android:name="android.intent.action.MAIN"/>
also try this
<activity android:name=".MainActivity"
android:excludeFromRecents="true" ...
in your AndroidManifest.xml's activity declaration.
In the manifest, it is possible to specify multiple activities:
<activity
android:name=".Activity0"
android:label="#string/app_name0">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activity1"
android:label="#string/app_name1">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
These will then result in two icons, placed on the launcher. I was wondering if the application can register more icons programmatically (based on application settings / user interaction with the app). Note that they would not need to run different activities, a single activity, starting with different intents would also work. Is this possible, or does one have to use widgets?
no need to use widgets - you can just add dummy activities that start your needed activity with the right parameters and then finish - you can also exclude them from recents so the user does not see the activity at all.
You can also install a shortcut by runtime - but then you need permission: INSTALL_SHORTCUT
I have two different codes for an android app. One of written in java, and the other one writed in adobe flex. The funcitonality is different for both programs. But it serves like a one program. I mean both of them are connected and when necessary first one intending the second one. I have to bundle them and when the user installs this bundle, the flex one shouldn't has an icon. So how can it become to one apk and one icon with saving the intends?
In your manifest, each activity declared with a category of type Launcher has its own icon in the menu drawer.
<activity
android:name="fr.hozakan.productreminder.client.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>
Remove the category tag on the activity of your choice, then it should be OK
I have an application where I need to provide a additional icon acccessible in applications to launch an activity from the same application.
So that when application installs it shows two icons in the applications list, one icon to launch the app is already there, how to have the other icon and then how can I start the required activity from that icon/shortcut.
add this in the manifest file inside the activity tag which you want to show in the launcher
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
I want two launcher icons for two different activities in my application. I have added this to the Manifest file.
<activity ... android:name=".TestActivity01">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity ... android:name=".TestActivity02">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
This works fine if you install the app with the two launcher icons since the beginning.
My problem is that I have already published my app in the Market with one icon launcher only. If I just add the intent-filter with the .Main and .Launcher options to another activity it doesn't work when the users update the app. They keep having one icon only. If they uninstall the previous version and then install the new one then they will have the two icons.
Question: is there a way I can force a "clean" upgrade? I don't have problems with loosing information.
Hi first time u have update the application in android market one lancher and second time u have update the next version your application in this application u have check the package u can modify the mainfest file another lanching activity what is the use two lanching icons (user download u r app this time another app download option is it correct ) In android market every updations only compare to package only.