I'm using my Android (Archos 43) only as an extended display in an industrial application. I just need a single program to display data received, and send user inputs by bluetooth. This little program should start directly after booting and should disable (fade out) the android-buttons (search, home, menu and back).
Here's my problem:
I know, there are some applications which can fade out these search/home/menu/back-buttons (like DeskClock or some videoplayers), but how does it work? Just using:
android:theme="#android:style/Theme.Light.NoTitleBar.Fullscreen"
only disables the titlebar, not the 4 android-buttons.
It's not an android-problem, this is a special feature from my Archos 43 internet tablet.
androidManifest.xml:
<uses-permission android:name="archos.permission.FULLSCREEN.FULL" />
<uses-permission android:name="archos.permission.FULLSCREEN.FULL" />
Related
When Android backgrounds an application it creates a screenshot of the current screen. The screenshot is displayed when you click the Overview button.
Is there a way to prevent this backgrounding screen shot (as if I'd used FLAG_SECURE), but allow the users to take screenshots?
You can configure not to show your activity in recent list. Add following code in manifest :
<activity
.....
android:excludeFromRecents="true"
...../>
Or from java code startActivity with flag:
intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
Or,
<activity
.....
android:noHistory="true"
...../>
Try this https://stackoverflow.com/a/49442984/5939067 .
The solution above simply sets the secure flag when your app goes background, and clears it when it resumes(so you can take the screenshot while using the app).
It works perfectly for me. I tested with Samsung Galaxy 9+(Android 9), LG V30(Android 8) and LG G7 ThinQ(Android 8).
In a business context (not commercial app), I need to avoid middle button click behaviour, that is to say displaying Home Screen
I spent hours browsing Stackoverflow pages, and the conclusion is often :
it's not possible, regarding obvious security considerations
My need is a bit different :
I use a connected mouse, I don't want to override device hardware button.
my app will only be use in a business context, not publicly.
Details :
my device is a Samsung Galaxy 3 (Model Number GT-P5210, Android version 4.2.2)
the mouse is a classical 3-buttons mouse (left-click, mouse wheel, right-click)
I can accept :
to override OnPause, OnUserLeaveEvents (https://stackoverflow.com/a/32938986/2773267 doesn't work in my case)
to modify my manifest
to use a service (watchdog-like), that prevent Home display
to root the device (last-chance solution):
modify /system/usr/keylayout (part of https://stackoverflow.com/a/29311126/2773267 answer)
all others solution, excepted those I can't accept :)
I can't accept :
using service (as in http://www.piwai.info/chatheads-basics/)
--
Thanks, Jerome.
Excuse my awful english, I'm french !
Putting this 3 lines to the manifest solved the problem.
Firstly it didn't work because I made a mistake on activity name
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
Thanks !
--
Jerome
You can build your app as a HOME-screen replacement. In this case, your app IS the HOME-screen, so pressing HOME does nothing.
I have an app with a difficult name that the system's built-in speech recognizer is not able to properly understand. For this reason, assuming that my app is called X, I would like to be able to launch it by saying "Start Y."
As described in the official documentation, the name of the app is defined in the manifest:
<application
...
android:label="X" > ... </application>
while the text to say after the "Start" command is defined here:
<activity
...
android:label="Y" > ... </activity>
However in doing so the name of the app in the app list becomes Y, while I would like it to remain X...
The only thing you can do is to use an activity alias with a different label. In this case the user will see two icons in the list.
I have a HTC one M8 running Android 5. I have gone into settings -> more -> data usage -> restrict background data (checked)
This should turn background data off.
I would like to turn it back on (uncheck the checkbox) programmatically with the following code in onCreate of one of my Activities.
ContentResolver.setMasterSyncAutomatically(true);
.
Unfortunately it doesn't turn back on. I have the following in the manifest
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
Are there any ideas why this isn't working?
thanks in advance
I have an air for android app that has event listeners for ACTIVATE and DEACTIVATE, inside the activate I tell the screen to stay awake and in the deactivate I tell it to go back to normal like so :
stage.addEventListener(Event.DEACTIVATE, deactivateHandler);
stage.addEventListener(Event.ACTIVATE, activateHandler);
protected function deactivateHandler(event:Event):void{
SFX.disableSound();
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.NORMAL;
}
protected function activateHandler(event:Event):void{
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
But the screen will stay awake at all times even when on the android home screen unless you force close the app... any ideas?
Thanks
I had this exact problem. My app was able to keep the screen on by setting systemIdleMode to SystemIdleMode.KEEP_AWAKE, and it would force the screen to stay on. However, when the app tried to set the systemIdleMode back to SystemIdleMode.NORMAL, so the screen could turn off, the screen was still staying on.
What turned out to be the problem in my case is was a missing android permission. I had already added this permission to my app XML file, so that i could use the keep-alive function:
<uses-permission android:name="android.permission.WAKE_LOCK"/>
Turns out this is not the only permission you need. I added this permission also:
<uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
And suddenly my app was able to let the screen be turned off again.
You could try using this in your java code:
// Gets one of the views visible on the screen and sets keepScreenOn to true.
// This means the screen will stay on as long as the specified view is visible.
this.findViewById(R.id.viewId).setKeepScreenOn(true);
Or you could put android:keepScreenOn="true" in your layout.