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.
Related
I am developing a Huawei custom Theme. I was trying to change some Google apps (Documents, Sheets and Slides) icons. So I used as address their package name e.g. com.google.android.apps.docs.editors.slides
Since it didn't work, I tried with some activities, found in the manifest file, but no one worked yet. (for example com.google.android.apps.editors.homescreen.HomescreenActivity, which is the first one that appears when I open Slides);
So the question is:
is there a way to identify which is the main activity, nay, which is the activity who defines app icon?
Usually, the main activity declares the following intent filters (documentation) in order to indicate for the system that this activity is Main and is a launcher activity:
<activity android:name=".ActivityClassName">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I want to remove the Android notification bar/panel (in my original post I said service bar) at the top of the screen when you swipe down. I have read multiple questions but can't find the solution in an easy explanation. I want to use it for kiosk mode. Can someone help me out and explain where I have to add the code.
Thanks!
EDIT: I found this question on the website: Disable the notification panel from being pulled down
i want to know which code i can add and where in android studio.
You mean the "ActionBar"?.
You can remove "ActionBar" by adding "android:theme="#style/AppTheme.NoActionBar" to the Activity tag in AndroidManifest.xml like below.
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
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.
Instead of declaring a pre-determined launcher activity in my manifest using an intent filter:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
Could I, instead, be given programmatic control over the activity which gets run when the application launches?
I'm not able to find anywhere in the documentation which says I must use the intent filter approach... but I also don't see any discussion of the alternative(s).
http://developer.android.com/guide/topics/fundamentals/activities.html
http://developer.android.com/guide/topics/intents/intents-filters.html
Thanks.
As far as I know, it's not possible. Android creates or sets up the hard link of the App icons to their respective activities by looking at the manifest. If you don't set it, you will not find any icons/shortcuts for your app after you install it.
I have searched and searched and cannot seem to find the answer to this specific question about a custom intent.
I have an application with 4 activities, 1 is the main that sets things up and the other 3 represent the different screens I present to the user. I am trying to use custom intents to start the different activities.
Here is my AndroidManifext.xml:
<?xml version="1.0" encoding="utf-8"?>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".Activities.REDB_main" android:label="#string/app_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activities.ChooseCards" android:launchMode="singleTop">
<intent-filter>
<action android:name="#string/ACTION_VIEW" />
<action android:name="#string/ACTION_REFRESH" />
<category android:name="#string/CATEGORY_SHUFFLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".Activities.SelectSets" android:launchMode="singleTop">
<intent-filter>
<action android:name="#string/ACTION_VIEW" />
<action android:name="#string/ACTION_REFRESH" />
<category android:name="#string/CATEGORY_SELECT_SETS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".Activities.SelectCards" android:launchMode="singleTop"
android:permission="android.permission.ACCESS_CHECKIN_PROPERTIES">
<intent-filter>
<action android:name="#string/ACTION_VIEW" />
<action android:name="#string/ACTION_REFRESH" />
<category android:name="#string/CATEGORY_SELECT_CARDS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
I create a category for each application and then the two kinds of actions I want it to handle. I know that I could use explicit intents, but since I want to have different actions I figured that making the implicit intents would work better.
I call the first of my real activities from within my main with this:
Intent intent = new Intent().setAction(getString(R.string.ACTION_VIEW));
intent.addCategory(getString(R.string.CATEGORY_SHUFFLE));
startActivity(intent);
Of course, the reason I am here is because the above can never find the activity that matches the intent. The error messages states the action and category correctly and unless I'm wrong, the above manifest creates the intent-filters correctly.
Searching around online, I always seem to find examples with data also being used. I messed around with adding data just to see if it was necessary but it did not seem to matter.
On a slightly different note, is there a different way I should be controlling the flow of my program besides intents? The reason I have two actions is because 1 switches the view while the other is there to just refresh the data so that when the user switches to the screen later, they don't see it quickly refresh the data but instead just the new stuff.
I know that I could use explicit intents, but since I want to have different actions I figured that making the implicit intents would work better.
I rather doubt that. Mostly you use <intent-filter> when you want things other than your own app to start the component (e.g., third party apps).
Also, I doubt you want android:launchMode="singleTop" on all of those. And I am very certain that you do not want android:permission="android.permission.ACCESS_CHECKIN_PROPERTIES" on the last one, as you won't be able to launch your own activity then, most likely.
The error messages states the action and category correctly and unless I'm wrong, the above manifest creates the intent-filters correctly.
I have never seen an Android application use a string resource for a <category> element. Perhaps that is contributing to your difficulty. Also, since the <category> elements are not doing you any good that I can see (except your LAUNCHER one), I am unclear why you put them there.
I suggest that you just drop the <intent-filter> elements and use explicit Intents.
Don't use resource strings to make intents actions, use android.intent.action.VIEW instead