Android App doesn't rotate on normal (non-large) devices - android

I'm writing a chat app in which I have two different layouts for normal and large devices, similar to the Telegram app. I have an MainActivity that on non-large devices has only a fragment containing the list of chats in it's layout.xml. On large devices the layout.xml also includes a fragment, where you can write in the chat.
My problem is, that on large devices (e.g. Nexus 9 Virtual Device) the app rotates fine when I rotate the device, the activities are reloaded etc. But on non-large devices the app won't rotate after it is started. I have tried this on Nexus 5X API22 and Nexus 5 API23 Virtual Devices and on a OnePlus X and a Samsung Galaxy S7 Edge, all with auto-rotate activated. There is nothing in the AndroidManifest or anywhere else in my code, that has any influence on configChanges. I let Android handle them and don't handle them myself.
I can get the app to rotate on non-large devices when I open the app, got to overview or start another app, rotate to landscape and then go back to my app through overview. After doing this, it reacts normally to rotation. This means I can then rotate it around and the layout/activity is reloaded accordingly by Android.
I couldn't find anything on this anywhere, neither on SO, nor through googling. Please help me, if you have any ideas, where this problem could stem from.

Related

App Working Perfect with Android 4.2.2 but not with 4.4.4

I am kinda new to App development and working on my first app, which is taking a burst mode of pictures with the current gps coordinates attached to each picture.
I was trying this app with my Sony Xperia L with JellyBean 4.2.2 and it takes burst shots of any number I have input. I tried to run my App in 4.4.4 and it runs basically, open the number of cameras, but i click to 'take' picture, my app crashes.
NOTE:
Behind this take picture button is kinda loads of work loadI know it sounds stupid to put up all things in main activity, but i dont know how to take off the load.
The fact is its running on 4.2.2 as expected (with many errors in LOGCAT but still running cool) and it crashes when i click 'Snap' in 4.4.4.
in main activity, I am taking jpeg PictureCallBacks and put up the gps listener, pushing to make a photofile with the EXIF DATA embedded and all in MAIN ACTIVITY. here is the picture
You are not allowed to use the android.intent.action.MEDIA_MOUNTED broadcast anymore on Android 4.4, it's protected. Try to use ACTION_MEDIA_SCANNER_SCAN_FILE instead.
See this question, or also this one.

Screen rotation not working as intended on some devices

This issue seems to occur on some Android devices, notably the Kindle Fire. I'm currently developping an app that runs in Landscape Right and Landscape Left modes, but it seems on some Android devices it starts up on one side then cannot be rotated afterwards.
I'm using Unity 4.3.4f, and my settings are set to support both landscape modes and is set on Auto-Rotation.
Also, I've made sure the problem isn't about the auto-rotation being locked on my device, so it must be something related to my app settings.
Any reason this works on some devices and not on others ?
Note : This issue doesn't occur on iOS devices.
UPDATE : This issue occurs only sometimes on some devices. Sometimes rotation will work fine, other times it just will stay stuck in one direction. Same build, upon killing the app and restarting it may work. Kinda confused as to why this is happening !
Check if in this devices you dont have the rotation blocked in settings.

Camera App in Portrait Mode

We are making an application which supports both tablet devices and mobile devices. We have provided different layouts for both the mobiles and tablets. We support landscape orientation for tablets and portrait for mobile.
Now we have one screen in app which allows user to open camera and take picture which then will be saved and shown to the user once the user will close camera.
App works fine for tablet devices. But for mobile devices, it crashes once the camera app is closed after taking the picture. I then found out that Camera app for devices other than Nexus(Vanilla Android in general) have landscape orientation by default (App works fine for nexus devices) and so it recreates-reinitializes my main activity (from which I have loaded my fragment) after closing that camera app.
After trying to dig out some more, I found that camera app has orientation landscape in it's source code file so I can't change that. That leaves me with 2 options :
1) I need to integrate camera in my app only -- it can be done but I don't want to do this option as it doesn't seem appropriate.
2) I need to implement some way to save instance of activity -- I have only one activity (to support tablet layout) which loads all different fragments (around 30-35 fragments I guess - may be more than that) and all this fragments have it's own callbacks to activity. The fragment which opens the camera app is also opened by some callback method in activity so it seems very complex to implement this also. There will a huge number of variables to be retained which is not good.
Please give me some other suggestion as to what other things can be done ? Otherwise I will have to integrate camera in my app itself.
Thanks in advance for your help.

Display separate activity on Samsung Galaxy Tab HDMI output

I'm reworking a project where I control LEDs on a miniature model, and display a presentation at the same time on an LCD Monitor above.
I previously had to work with a clunky touch screen laptop/tablet hybrid which was hooked up to an external monitor which showed a presentation slide while it lit up the LED.
I've now developed an android application for the Galaxy Tab 10.1 which controls LEDs on a miniature model via bluetooth, and is hooked up to the monitor via the Samsung HDMI adapter.
My question is, is there anyway to output two separate activities one for the tablet, one for the screen? The current setup just mirrors the screen, but when I open a slide it automatically displays the video in full resolution on the screen so it can be done, but I'm not sure if its an open API (Can't find one!).
Cheers!
Response from Samsung
Unfortunately Android itself does not support multiple displays, as
stated here:
https://groups.google.com/forum/#!topic/android-developers/Jxp_9ZtzL60
and Samsung also does not extend this functionality.
In that thread it does point out a useful Motorola API to control the HDMI output, shame I've got a load of Samsung tablets!
http://developer.motorola.com/docs/motorola-hdmi-status-api/

Screen Blinking/Flickering in Application in Samsung Galaxy Tab 10.1 with Android 3.1 Honeycomb

I have this browser launching application which didn't have any problem till now: when it is being tested on Samsung Galaxy 10.1 (Model Number: GT-P7510) with Android 3.1 Honeycomb.
The issue is this: whenever I tap on a text box, the whole screen will flash across a black screen for a moment and revert back to normal. It starts flickering/blinking the black screen when I leave a focus on any text box as well.
Currently, I've no idea what is causing this issue as I've tested this application on several devices e.g. Samsung Galaxy S, Samsung Galaxy Tab 7-inch with previous version of OS from 2.1 to 2.3.
Anyone who has any clue as to what is going on whether be it a compatibility issue with the app or a change in function in honeycomb 3.1 or the device itself, please share your information and enlighten me on this matter please. Any kind of help is greatly appreciated!
Thanks
I'm sorry that this is not a solution, but I think I can shed some light on the problem.
We have recently been testing a functional jQuery Mobile HTML5 app wrapped with PhoneGap Android 2.x phones to the Galaxy tab 10.1. We have seen something very similar, with the exception that we have defined a splash screen for our app. What we see is that when an input field is given focus, the screen flashes up the splash screen momentarily. Very annoying! To verify if this is the same problem, define a splash screen for your PhoneGap app and see if the screen flahes your image instead of a black background. Knowing something about what's going on with PhoneGap and the Android WebView, this is my best estimation of what is happening: PhoneGap loads the main App activity with a black background and displays the splash screen (if defined) in that initial window. PhoneGap then starts the WebView and opens it on top of the main Window. When a field is selected, the Android invalidates the component wach time it updates it based on a focus event or keypress, or whatever, and Android redraws everything. So it redraws the main window behind the WebView and then redraws the WebView with the HTML page content on top of it. Since the device is not properly double-buffered, you see all of this redrawing in all its ugly glory right in front of your eyes.
We have seen serious glitches with Android web forms on some Android 2.x phones we have tested, and this looks like yet another glitch, but this time on the Galaxy Tab running Honeycomb (3.0).
We have attempted to use CSS -webkit-backface-visibility to resolve issues on some phones when experiencing flicker in the past - but this has caused serious rendering issues in HTML forms. Be warned! In theory this should be a viable fix to introduce some double-buffering into the mix, but in our experience it causes more problems than it solves.
I am not confident that this can be resolved, except by an Android software update from Google/Samsung.

Categories

Resources