I'm currently writing an Wallpaper application for android. I wish to support rotations that's no problem. For a better usability I need to know if the homescreen rotate the screen.
Is there a default that all phones doesn't rotate there homescreen? Currently all phones I have seen didn't rotate. But tablets change the orientation of homescreen. Or there are differences between manufacturers?
I have search for a method (or constant) like boolean supportRotation();
Does anyone have any experience with this problem?
Thanks for help.
I've read that this is not possible, given the fact that any particular user could be using any one of hundreds of launchers available for the home screen.
You could explicitly allow the user the option of enabling the rotation feature, depending on their home screen configuration. i.e - just a simple checkbox in your app.
Alternatively you could extend the app for more screen sizes. Since you are already dealing with different screen widths/heights you could just make this compatible for all screens. Not as trivial though.
You can determine the screen orientation within the app itself but the home screen is a different story altogether.
If someone does have a solution I'd be glad to know, but I don't believe it exists, I've experienced the same problems as you too.
Almost all android device support rotation or say orientation modes.
I suggest you must specify which orientation of your app.
Don't apply the orientation to the application element, instead you should apply the attribute to the activity element, and you must also set configChanges as noted below.
Example:
<activity
android:screenOrientation="portrait"
android:configChanges="orientation|keyboardHidden">
</activity>
This is applied in the manifest file at, for example, /platforms/android/AndroidManifest.xml.
Related
We are an OEM working with an external app developer. The app they have written locks to portrait with android:screenOrientation="portrait" in its manifest. It also disallows resizing with android:resizeableActivity="false".
Our device is designed for use in vehicles and as such operates as a vehicle control head. It does not support portrait mode; any apps that request it are resized to allow landscape display. Because of the aforementioned attributes in the manifest, the app always displays in screen compatibility mode, with the UI squashed in the centre of the screen.
We've tried a number of different solutions. We tried setting the orientation programmatically instead of the in the manifest, but this causes an initial rotation on some handset devices that the app already supports, and which was deemed unacceptable by their QA team. They maintain that the attributes in their manifest mentioned above MUST NOT be removed.
Has anyone been in this situation? Are there any fixes on the application side that we've missed? Would they have to revise their decision to statically disallow resizing?
I am working on android app and wish to make this app work only in portrait or reverse portrait mode. In the manifest file I mentioned screen orientation value as "sensorPortrait" but app works only in portrait mode, i.e., if I hold my phone upside down, nothing changes in my app. Although, I do have other apps on my phone that work in both portrait and reverse portrait mode. I have seen similar question asked before but suggestion given don't work as those questions were asked way back and suggestion given might not be a good answer anymore. Any recommendations? Thanks!
You can add in your AndroidManifest.xml file, you need to configure the to use the orientation from the sensor. This should be the default, but you can force it to the sensor's orientations, for all 4 possible orientations, with android:screenOrientation="fullSensor"
<activity android:name=".MainActivity"
android:screenOrientation="fullSensor"/>
I am working on a widget. On the typical phone, I would prefer it to be 4x2, filling the width of the home screen. However, on some larger phones (i.e. Samsung Galaxy Mega), the launcher has 5 cells' width. I am trying to find the best way to automatically change my widget provider to be a 5x3, based on the launcher cell dimensions.
Currently, we have two providers: a 4x2 and a 5x3. Since we only want to show one (4x2) on normal-size phones (they don't support 5x3), we do a runtime check when the widget is added to check if the device model matches one of the models with a 5-cell wide launcher. We then disable the other widget provider component. However, this isn't ideal, as the 5x3 will show up temporarily in the app drawer and cause the launcher to force close if the user tries to add it.
Any thoughts on how to work around this? I realize I most likely won't be able to read exactly the cell-width size, as there are tons of launchers, and there isn't an API to check. However, I think we would all agree that there must be something better than keeping a static list of devices that have a 5-cell screen (not to mention people with custom launchers can set a range of widths).
I have thought briefly on using the resource folder qualifiers (sw720dp, etc.) ...but that still doesn't solve the issue of determining what the user's launcher's width in cells is.
Thanks for the help,
Drew
P.S. I also realize that a similar question was asked here: Appwidget Maximum Width that fits all screen sizes with no comments or answers. Any input would be much appreciated.
Any thoughts on how to work around this?
Allow your app widget to be resizeable, so users who want it to fill the home screen width can elect to do so.
I'm writing a game for Android and am laying out the playing screen myself, handling both vertical and horizontal orientations, and haven't done anything if the width and height are the same.
Does anybody know of at least one Android device that has a perfectly square screen resolution?
The MotoACTV is 220x176 (not square but close), the WIMM One is 160x160 (square).
The MotoACTV has been rooted, but the default device runs a customized Android. It's a pretty cool device, though. The WIMM is slick and runs a more-standard Android.
None the I'm aware of. Every device I'm familiar with has a distinctive "portrait" vs "landscape" mode.
It would probably be wise to make sure your code can always gracefully handle portrait vs landscape - even if you ever happen to run across a square device.
Conversely, if you want a square - just "crop" the image appropriately. The cropping, of course, will become "zero" if you ever encounter this hypothetical "square screen". :)
This is a rather late answer to this question, but things have changed somewhat since then, and although there are still no mainstream Android devices with square screens, there are 3 square BlackBerry devices (Q10, Q5, and Passport) that can run Android apps, and so would fall under that criteria. Interestingly, when an app is run on a square BlackBerry Passport, and the device is rotated to its side, the app also rotates, however none of the onPause(), onStop(), or onDestroy() events are called, and so the activity is not destroyed and re-created, but the current activity layout is re-used. So, in that respect, nothing happens, and you don't have to worry about saving/loading resources and such.
This behaviour is actually built-in in Android -- it will only destroy and re-create an activity, if the screen dimensions change. The API docs don't talk about this edge case, as there are no square Android devices, but you can see that the reason for destroying and re-creating the activity during orientation change is to load alternative resources specific for the new orientation. Since rotating a square device doesn't change the screen dimensions, there is no need to load alternative resources, and therefore, there's no need to destory and re-create an activity. I hope that helps.
I believe the WIMM ONE is the only square screen Android device out there. It has capacitive touch display at 160x160.
Yes, the Motorola Flipout is one.
I have done my application in portrait configuration. When I load my application in device its coming portraint configuration. But in landscape mode i keep missing some controls. How can I fix the screen for both configurations?
This question was asked before: here
If you are a beginner, you might find the following useful(read up):
Developing orientation aware Android apps
You probably have to define different layouts for landscape and portrait. You could force android to choose the proper layout depending on orientation. You could put landscape layout xml files in “res\layout-land” and portrait in “res\layout”.
Of course it’s always good idea to use RelativeLayout, but it depends on your application.
Regards!
Check this out. Google has released a tutorial about this recently: https://developer.android.com/resources/samples/MultiResolution/index.html