Android Orientation Sensor Different for Different Devices? - android

I'm developing an Android game that uses the orientation sensor to get the rotation of the device (to roll a ball). I have two devices that I test apps on, one is a Samsung Infuse (phone) and the other is an Asus Eee Pad Transformer TF101 (tablet).
The app runs in landscape on both devices. The problem is that on the Eee Pad, the orientation is measured with the device sideways (landscape mode) while the Infuse measures in upright (portrait) no matter what I do. This makes is so the ball moves left when I tilt my Infuse left, but when I tilt the Eee Pad left, the ball moves up or down.
I can switch the orientation angles, so they move the ball the other way, but it only works for one or the other at a time. Any ideas how I could fix this?
Yes, I am using the deprecated TYPE_ORIENTATION, and not the getOrientation() method. I tried setting it up, but I never got it working correctly and it always spat out really weird values, so I stuck to the deprecated one. Would switching over fix this at all? If so, can someone link me to resources to implement this?

Google's docs make it clear that the sensor coordinate system is relative to the default orientation of the device. That description mentions the getRotation() and remapCoordinateSystem() calls you can use to adjust appropriately.

Related

A-Frame AR.js on android portrait mode not showing in place

I am developing a webAR using AR-js and A-frame, works perfectly with iPhone in landscape and portrait mode BUT in android only in landscape, when in portrait all augmented reality is not shown on the trigger image (Image Target ), appears shifted sideways and quite unsteadily. Is there any way to fix this?
I'm using a template based on the example at https://medium.com/swlh/ar-js-the-simplest-way-to-get-cross-browser-augmented-reality-on-the-web-10cbc721debc:
I also got the same issue some days back. It is because in aframe-ar doesn't have provision to correct the orientation shift(90 deg rotate). It might be working on the iPhone because of the auto-rotate. Try in android with auto-rotate(It may work).
Use console.log(event.details.intersectedE1) to know the exact
position of the trigger event.
I think this might help you out.
Caution: iPhone safari doesn't allow console.log().

Reverse Portrait For Android

I want to reverse the orientation of my device.
I tried using the option ro.sf.hwrotation 180 but it rotates the display but doesn't rotate the touch.
I have found many leads through patches but all are for froyo or Gingerbread. I need it for JellyBean(4.1.2).
Please Help
http://developer.android.com/guide/topics/manifest/activity-element.html#screen
"reversePortrait" Portrait orientation in the opposite direction from normal portrait. Added in API level 9.

LG optimus 3D effect in portrait mode

I am working on LG optimus 3D mobile platform and it seems to me I can experience the depth of three dimensions in landscape mode but the effect is completely lost while the phone is in portrait. does anyone have any suggeston how to make that work on portrait mode as well?
If you are using the p920, i'm afraid you (actually we cuz I have one too) are out of luck. 3d is landscape only.
Reference links :
http://3dvision-blog.com/5798-testing-the-3d-capabilities-of-the-lg-optimus-3d-p920-smartphone/
http://blog.gsmarena.com/htc-evo-3d-vs-lg-optimus-3d-taking-the-fight-to-another-dimension/

Android augmented reality. Bad sensors reading

First of all, sorry for my english. I'm programming an Augmented Reality Browser for Android following the steps in Raghav Sood's book. Its title is Pro Android Augmented Reality. The thing is that when i launch the example of chapter 9 (named Pro Android AR 9 and located in https://github.com/RaghavSood/ProAndroidAugmentedReality) in my devices, it works fine or not depending on the kind of device.
In my Sony Ericsson Xperia Arc with Android 4.0.4 the browser implemented by Raghav works really fine. When i test the augmented-reality browser in Asus Eee Pad Transformer or in Samsung Galaxy Tab, both of them with Android 4.0.3, the readings from the sensors seem to be wrong. Holding the tablets in landscape mode in front of me, if i focus over one spot (wikipedia, twitter or local markers) and turn over myself to the right, the spots goes down. If i turn to the left, the spots goes up. If i want the spots to move to the left, i have to tilt the devices making their screens look to the ground. In the same order, if i turn the devices making the screens look up to the air, the spots will move to the right.
Seems like the program is confusing sensor readings. Anyone knows how to solve the problem??? Thanks in advance.
i made it. I don't know if it is a good solution but seems to work fine on tablets.
Changing the axis to:
SensorManager.remapCoordinateSystem(temp, SensorManager.AXIS_X, SensorManager.AXIS_Y, rotation)
in SensorActivity seems to fix the axis malfunction. Other problem was that the text asociated with each POI appeared turned in tablets using landscape mode. To avoid this, i used a conditional rotation modification in set method of PaintablePosition class:
if(drawObj.toString().toLowerCase().contains("paintableboxedtext")) rotation=rotation+270;

Exploded portrait HDMI output on Android (Samsung Galaxy S III)

Currently, when you connect an external monitor to an Android phone that supports mirroring, the phone makes the assumption that the external monitor is set up in a landscape orientation. Thus, when the phone is held vertically (in this case, the Galaxy S III) in a portrait orientation, the video output on the display is portrait, but centered with black bars on either side. Of course, when the phone is held horizontally, the output fills the external display.
What I'm looking for is a way to force the Galaxy S III to mirror its screen such that when it is held in a portrait orientation, the output will fill the external display. It would have to work across Android - I'm not talking about a specific app in particular, it needs to work consistently across all apps.
The external display would be mounted vertically, so it's essential that the output from the Galaxy S III while in portrait orientation completely fills and has the correct orientation on the external display.
Can anyone give me any advice on where to begin? I've already looked through the source code for the S III and haven't been able to find any clues (I'm not experienced in writing my own drivers on Android). This would be for the US variants (specifically Verizon, though the video hardware - Adreno 225 GPU and SiI9234 MHL controller chip - is the same across all US variants). Perhaps someone who is more experienced in that field could shed some light on this.
Unfortunately that is not possible. you would have to develop your app in landscape mode and then rotate all your views/content to make it seem it is in vertical portrait mode. One option for that would be animations. ie:
rotateAnimation.xml:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="-90"
android:pivotX="50%"
android:duration="0"
android:fillAfter="true" />
Your Code:
TextView text = (TextView)findViewById(R.id.txtview);
text.setText("rotated text here");
RotateAnimation rotate= (RotateAnimation)AnimationUtils.loadAnimation(this,R.anim.rotateAnimation);
t.setAnimation(rotate);
Also you can have a look at this post:
Vertical (rotated) label in Android

Categories

Resources