[Q] Intercepting the accelerometer ? - Android Software/Hacking General [Developers Only]

Hello,
Another simple question:
I am developing a game on Android. Whenever the device (equipped with a accelerometer) turns sideways, the app RESTART on a rescale landscape display.
I don't really mind the graphics rescaling (my work, to accommodate different screen size..), but I mind the whole state of the game being reset!
So, my question is:
How can you intercept the accelerometer movement so that the app will NOT reset the display, landscape/Portrait, and hence the app ?
I've tried installing a SensorEventListener in the Activity class, and I was able to read the accelerometer, but not to intercept/avoid the resetting of the graphics sideways.
I've seen code that seems to work as I want to in an OpenGL app with overriding "onSurfaceChange(GL10 gl, int width, int height)"
But my game isn't OpenGL.
Is there an equivalent on "Activity" ??
Thanks!

Found my answer:
android:screenOrientation="portrait" in manifest.xml

Related

[Q] Gallery3D Only support Portrait Mode phone?

Hi All,
we are now developing Android phone on mmp2 board which is of landscape mode. We found Galley3D works perfectly on portrait mode phone while has a problem on landscape one. As you know Gallery3D can tilt pictures/videos according to values of Gsensor. But the Gsensor’s coordinator on landscape mode phone is different from that of portrait. This difference make Galley3D’s not working well on our mmp2 board, i.e., Gallery3D only supports portrait mode phone. Below is for the details:
Let’s take a look at onSensoChanged function in file GridInputProcessor.java, Gallery3D calculates the tilt value from X-axis value (values [0]) / Y-axis value (values [1]) depends on the compare of current display’s width and height.
public void onSensorChanged(RenderView view, SensorEvent event, int state) {
…..
switch (event.sensor.getType()) {
case Sensor.TYPE_ACCELEROMETER:
float[] values = event.values;
/*tilt value is calculated from X-axis value (values [0]) / Y-axis value (values [1]) */
float valueToUse = (mCamera.mWidth < mCamera.mHeight) ? values[0] : -values[1];
float tiltValue = 0.8f * mPrevTiltValueLowPass + 0.2f * valueToUse;
…… }
break;
}
}
For Portrait mode phone:
(1) When Gallery3D is in Portrait mode, tiltValue uses value of X axis since mWidth < mHeight, Galley3D would tilt the pictures when X value of Gsensor changes, this behavior is expected.
(2) When Gallery3D is in Landscape mode, tiltValue uses value of Y axis since mWidth > mHeight, Galley3D would tilt the pictures when Y value of Gsenso changes, this behavior is expected.
/samba/PortraitMode.bmp
For Landscape mode phone:
(3) When Gallery3D is in Portrait mode, tiltValue uses value of Y axis since mWidth < mHeight, Galley3D would tilt the pictures when Y value of Gsensor changes changes, this behavior is unexpected.
(4) When Gallery3D is in Landscape mode, tiltValue uses value of X axis since mWidth > mHeight, Galley3D would tilt the pictures when value of X value of Gsensor changes, this behavior is unexpected.
/samba/LandscapeMode.bmp
Questions:
(1) Do we have solution to fix this issue? Is that in APP?
(2) There are some other Gsensor games in the market has the same issue, i.e., only support Portrait mode phone, e.g., the Teeter Game, is there any idea for the workaround in framework/SensorHAL so that those games can still be used in Landscape mode phone?
Hope above is clear; we are looking forward to your kindly reply and many thanks in advance.
it definitely supports landscape, I'm using it on my Dell streak using leaked eclair firm ware, quick is forced/ locked landscape.
unless Dell have altered the code, which can't tell because they won't release the source, can't really help much more than that. just to let you know that it works
Landscape works perfect on 3D gallery for my Evo with Froyo.
Can someone post an appbrain/androlib link or a QR code? I cannot find this app
It's a stock application...
Oh, mine is not called that. It's just "Gallery"

Parallel SBS (side by side) user interface for Android?

Hello everyone,
I'm thinking on a virtual/augmented reality project in which you wear a wielders mask (like this) and an android smartphone attached to its vizor. Because the phones screen is going to be so close to the eyes I need to know if it's possible to change the user interface to side by side parallel format stereoscopic view. That way it will be possible for the eyes to focus to the image onscreen with the aid of convex lenses. It doesn't have to be 3D, i just need a technique to turn what's shown on the screen to side by side parallel format.
Please reply, thanks...

[Q] How to change orientation of another application from inside my application ?

Hi ,
I am creating an application which will change orientation of some other already installed application , Reading the orientation of other application installed was simple through ApplicationInfo object but noway to change it.
After some R&D I have come to notice similar types of app's (which change orientation) also run Service , that means' they make orientation change on fly but I don't know how exactly they do it ?
Regards
New Android Developer

[RELEASE]GemRB - Infinity Engine recreation(Baldur's Gate, Icewind Dale,Planescape:T)

GemRB is project aimed to recreate Infinity Engine which was developed by Bioware and used in one of the greatest cRPG's of all time: Baldur's Gate 1&2, Icewind Dale 1&2 and Planescape: Torment. Now you can play all mentioned games on your tablet as I succesfully ported GemRB to Windows RT. To run GemRB you need to unpack my archive, install desired game on you regular PC, then copy whole installed content to ./GemRB/games folder and finally edit the gemrb.cfg(which is well commented so I'm not going to explain it). Performance wise, games are playable, older ones run full speed while newer ones encouter stutters here and there but still plays nicely. And that's all. Have fun
>>>>GemRB<<<<
bartekxyz said:
Sorry for teasing you but I ported GemRB engine which let's you play best Bioware's RPG like Baldur's Gate 1&2, Icewind Dale and more. Loading is a bit slow but game itself is smooth and very enjoyable. I said "teasing" because I'm not going to release it yet. I need to clean things a bit so be patient.
Click to expand...
Click to collapse
What a Great news ! Thanks a lot for the effort ! Looking forward to it :good:
DO WANT! I've been trying to get BG2 (well, TuTu actually - BG1 on the BG2 engine) running on the x86 emulator, but a native port would be fantastic!
love BG2 so much! can the game run in full screen?:victory:
wy328 said:
love BG2 so much! can the game run in full screen?:victory:
Click to expand...
Click to collapse
Yes, it can. I think that it will be ready to publish in few hours.
bartekxyz said:
Yes, it can. I think that it will be ready to publish in few hours.
Click to expand...
Click to collapse
waitting...thanks for your nice work
updated first post with link.
This is awesome..!!!! Major Kudos for porting this!
Hmm... it appears to mostly work, but I'm getting some odd errors. Note that I'm using the "tutu" mod for BG, which runs BG1 and BG2 sequentially, both in the BG2 engine; this could be the cause of some or even all of these issues. The cfg file is configured for BG2.
1. Touch doesn't work right (it acts sort of like a joystick controlling the mouse) on TouchFeedback=0. On any other level, there's no mouse pointer visible at all, and touch doesn't appear to do anything either
2. The display is corrupted at 1366x768 (UI elements not where they belong, panning is messed up, the "HUD" flickers in and out of view) even though the widescreen support is installed.
3. At 1024x768, the pause button is not visible in the UI.
4. (BIG PROBLEM) When I talk to people, the dialog text does not appear (either what they say to me, or what I may respond). This makes productive interaction with NPCs effectively impossible.
GoodDayToDie said:
Hmm... it appears to mostly work, but I'm getting some odd errors. Note that I'm using the "tutu" mod for BG, which runs BG1 and BG2 sequentially, both in the BG2 engine; this could be the cause of some or even all of these issues. The cfg file is configured for BG2.
1. Touch doesn't work right (it acts sort of like a joystick controlling the mouse) on TouchFeedback=0. On any other level, there's no mouse pointer visible at all, and touch doesn't appear to do anything either
2. The display is corrupted at 1366x768 (UI elements not where they belong, panning is messed up, the "HUD" flickers in and out of view) even though the widescreen support is installed.
3. At 1024x768, the pause button is not visible in the UI.
4. (BIG PROBLEM) When I talk to people, the dialog text does not appear (either what they say to me, or what I may respond). This makes productive interaction with NPCs effectively impossible.
Click to expand...
Click to collapse
1. All values on touchfeedback bigger than 0 hide pointer as then your finger is supposed to act as one, it's like that on purpose. Also touch doesn't work right in fullscreen as I used sdl library compiled by netham45 which has this issue, just try dosbox or any other app which uses sdl and is compiled for WinRT. I tried compiling sdl2 which from what I read have some advanced touch procedures and GemRB take advantage of it, Unfortunately I failed.
2. About widescreen mod, I can't tell if there are issues because i haven't used this mod.
3. In 1024x768 everything is good for me.
4. GemRB has some problems with writing ini files. Even if you set ingame options to you liking it's going to write strange values in. Just look at gem-baldur.ini in game foder and see that all values are either very high or always "0", that's why subtitles are turned off. I thought it's strictly related only to my build but when I tried to run gemrb on my win8 laptop, it produces same corrupted values. Nobody know why(including gemrb makers).
Ah, thanks for the tip on touch not working in fullscreen. Annoying that it can't just treat touch like a mouse pointer the way the Windows desktop does, though.
I'll mess with resolutions a bit more, see what I can find out.
At 1024x768 fullscreen, all UI elements except for the left control bar (minus the pause button) and main view are missing in-game unless I click one of those left buttons. No dialog, no shop interface, no event logging, no party/status/HP info.
At 1366x768 fullscreen, the UI flickers in and out as I move the mouse, but it still renders in the wrong places and I still can't talk to people.
GoodDayToDie said:
Ah, thanks for the tip on touch not working in fullscreen. Annoying that it can't just treat touch like a mouse pointer the way the Windows desktop does, though.
I'll mess with resolutions a bit more, see what I can find out.
At 1024x768 fullscreen, all UI elements except for the left control bar (minus the pause button) and main view are missing in-game unless I click one of those left buttons. No dialog, no shop interface, no event logging, no party/status/HP info.
At 1366x768 fullscreen, the UI flickers in and out as I move the mouse, but it still renders in the wrong places and I still can't talk to people.
Click to expand...
Click to collapse
For me GemRB with vanilla BG2 runs ok in 1024x768, no missing elements, about 1366x768 resolution read this: http://www.gemrb.org/wiki/doku.php?id=fap. If screen still flickers with widescreen mod installed then this whole tutu may be the case.
Widescreen mod is part of Tutu, but I tried reinstalling it just in case. Windowed at 800x600 works, nothing else that I've found does. Still awesome!
GoodDayToDie said:
Widescreen mod is part of Tutu, but I tried reinstalling it just in case. Windowed at 800x600 works, nothing else that I've found does. Still awesome!
Click to expand...
Click to collapse
I just tried the standalone widescreen mod with my copy and 1366x768 runs without any problem, although a bit jerky(about 17fps).
Does this work with the Enhanced Edition?

Fake rotation app for android

Hi everyone. The present question is originated because I have a 10" android tablet, which I use all the time on landscape mode, by using a forced rotation app. But I've could see that some apps aren't displayed on a "nice way" (mainly, their GUI is too big, and overflow the screen). I must supose this is because app developers, mainly focus their apps' gui to be used on portrait mode (and maybe that's because even on landscape mode, some apps try to rotate to portrait mode).
Ok so; First, I know that does exist apps which force screen mode (landscape, portrait, reverse landscape, and so on). Also I know that an "easy" way you can get a "workable" gui on those apps, is reduce android's DPIs (i have root access), but if I do that, I can "enhance" them, but I mess the rest of remaining "good" apps. And because of that, I know that does exist an Xposed (lsposed) addon, that allows to change dpi selectively, per app; but that addon almost hardbricked my tablet (hehe).
So finally I wondered myself something, and I want to ask you this: ¿Does exist any app that performs, or allow a "fake" rotation? I mean, for instance my case; I need that if my tablet is on landscape mode, and i try to open an app which doesn't "like" landscape mode and if forced to it, is poorly displayed; this app would make it display on landscape mode, as is if it was on portrait mode.
I don't know if i made explain right, but I know i'm not talking about something new, because I've seen before that behavior precisely on android emulators, so I know it's possible, but ¿Is there any android app that could do that?

Categories

Resources