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>
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.
I need the following problem to be resolved:
From the UnityPlayerNativeActivity I am starting a standard Android activity (may be mine, may be with an ad from the ad network - nevermind). When the game is being hidden with this activity on top (not the Unity one) by pressing the home button, as a user I have two ways of restoring it:
from the Recently used apps screen - the app is being restored to the same state, when it was minimized (that is what I expect to happen);
from the launcher, what causes the game's UnityPlayerNativeActivity is being restored with losing all other activities, that have been opened on top of it.
These activities are lost somehow (in a way I don't exactly know, what has happened with them). My game's logic depends on the result of the processes happening there, ie. I need to know, that this particular activity has been exited in any specific way (give a callback for example).
Do you know how I can bring this Unity activity back from launcher with all activities above it, as it was while minimizing it?
I want to understand the difference between the ways of restoring the app from Recently used screen and the launcher. I guess it is related to the intent-filter section within AndroidManifest.xml file, which is included within UnityPlayerNativeActivity entry.
The solution turned out to be quite simple, but not so obvious.
It has turned out, that the AndroidManifest.xml configuration that is being produced by Unity by default is causing this problem. For the main activity that is being started from launcher the following parameters are defined (taken from decompiled app):
<activity
android:alwaysRetainTaskState="true"
android:clearTaskOnLaunch="true"
android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
android:label="#string/app_name"
android:launchMode="singleTask"
android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:screenOrientation="fullSensor"
launchMode="singleTask">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>
The problematic behaviour is being caused by these 2 parameters:
android:clearTaskOnLaunch="true"
android:launchMode="singleTask"
When the I change them to:
android:clearTaskOnLaunch="false"
android:launchMode="standard"
Then the app is resuming fine from the launcher.
The correct parameters should be set as follows:
<activity
android:alwaysRetainTaskState="true"
android:clearTaskOnLaunch="false"
android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
android:label="#string/app_name"
android:launchMode="standard"
android:name="com.unity3d.player.UnityPlayerNativeActivity"
android:screenOrientation="fullSensor"
launchMode="standard">
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true"/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>
Note: While I am able to set the value android:clearTaskOnLaunch="false" for this activity explicitly, the launchMode parameter will be forced by Unity3d and set to "singleTask". I managed to change and check it by decompiling the app and rebuilding from these changed resources. I wonder if there is any elegant way to set this value.
You may find this blog post useful:
http://inthecheesefactory.com/blog/understand-android-activity-launchmode/en
I am developing an android app and when I install the app on android phone, the application icon does not appears in application section. But it appears in application manager and I can make uninstallation. After googling, some said I need to rebuild my project and to make sure the app icon in drawable resource. I already tried for this solution and the problem is still occurring. The manifest file I created is as follow:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".MyActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.view" />
<data android:scheme="geo" />
</intent-filter>
</activity>
</application>
I believe geo scheme cannot be used with Launcher. I can't find any documentation but in this tutorial they suggest to use with default category.
Please try to move your location related code to another activity and move scheme=geo filter to that one.
In your manifest in activity try using or add another intent filter
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
`
Change
android:icon="#drawable/ic_launcher"
With your icon
if you wanna to remove this icon you have to remove from all folder like
drawable
drawable-hdpi
drawable-mdpi
drawable-xhdpi
I set action android:name="android.intent.action.MAIN and android:name="android.intent.category.LAUNCHER two of mine activity intent.For this I'm having two launcher icon.When I noticed that I remove one activity's intent filter,but My launcher icon disappear.I tried all the mentioned above solution but didn't work.As I noticed Darpan's comment about re-starting your phone will fix it I tried and It works for me
In my case, my manifest included a label for the main activity. I deleted the label, restarted the app and the icon magically appeared in the applications list.
my android application crashes and shows force close when i tilt the mobile phone. is there any suggestions that i can remove such problem? By the way i am developing a LBS application which uses the google maps (MapView).
I have a splash screen and then shown a ListActivity as below :
<activity android:name=".Splash" android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Home" android:label="#string/app_name" android:configChanges="orientation" android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="com.nepways.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
what is wrong with my declaration, the splash screen loads and list activity is also whown correctly but when i change the orientation the application is closed. Please help me.
When you change your orientation the activity is restarted
look at the logcat to see what exception causes your application to FC
You can change your manifest to disable activity restarting by customizing configChanges, if you stil have the problem override onConfigurationChanged() to fix what is generating this exception (like initialize something that may cause a nullpointer)
First of all as it is said the app is restarting (or as it is said in reference redrawing) each time when you change orientation.
To block it in your manifest file in activity you have to put this line which describes the activity orientation:
<activity android:name=".Splash"
android:label="#string/app_name"
android:screenOrientation="portrait">...
And about this buttons, or keymaps. Telling the truth Ive got thise warnings sometimes but it doesnt change anything in my app. So first change the orientation settings and then it should work correct.
If you want use other screen orientation remember to check here:
http://developer.android.com/guide/topics/manifest/activity-element.html
If you want to avoid restarting your activity on orientation change, you can put this in the activity in the manifest file:
android:configChanges="orientation"
Otherwise, we will need to see more code, and a stacktrace.
I'm running into an issue with the Quick Search Bar that I'm hoping someone can help me with.
My application includes a Searchable activity used to provide search behavior within my application. That search activity is designed to trigger a separate Intent when the search item is clicked on so as to cause a different Activity to handle the viewing. When used within the application, the search behavior works perfectly every time.
My application also includes a ContentProvider used to provide search suggestions and is also configured to allow use in the Quick Search Bar. When used within the application itself, use of the search suggestions works fine every time it is used. When triggered from the QSB, the initial search suggestion brings up the viewing activity just as it should. After that point, however, any use of the search suggestions from within the application (i.e. bringing up the search and selecting a search suggestion) fails to trigger the viewing application. In fact, I've put debug statements in every single "onXXX()" method within the Searchable activity and I never see any of them get triggered. On the flip side, when I trigger a standard search at that same point (i.e. enter a query string and hit enter, rather than navigating to a search suggestion), the search dialog comes up, as expected, and selecting an item from that list successfully triggers my application.
I'm currently at a loss trying to determine why this would be occurring. Any ideas
As as some additional information, my manifest contains the following in regards to the searchable activity (".activity.SearchableActivity"), the suggestions provider (".content.TestSuggestionProvider") and the activity used to display the content (".activity.TestDisplayActivity"):
<activity
android:name=".activity.TestDisplayActivity"
android:label="#string/app_name"
android:launchMode="singleTask"
android:finishOnTaskLaunch="true"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.default_searchable" android:value=".activity.SearchableActivity" />
</activity>
<activity
android:name=".activity.SearchableActivity"
android:launchMode="singleTop"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="android.app.searchable" android:resource="#xml/searchable"/>
</activity>
<provider
android:name=".content.TestSuggestionProvider"
android:authorities="com.test.provider.suggest"
android:syncable="false"
/>
And the following is the XML used to further define the settings of the searchable activity:
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="#string/search_app_label"
android:hint="#string/search_app_hint"
android:searchSettingsDescription="#string/search_app_settings_description"
android:includeInGlobalSearch="true"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:searchSuggestAuthority="com.test.provider.suggest"
android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable>
Any thoughts? At the moment I'm at a complete loss…