As all of you know that G1 have accelerometer but so unfortunate that it doesn't come with Auto Rotate Screen function.
So I modified its source code for a little bit. And at last, I can bring the auto rotate screen function to G1 already. Please take a look.
http://www.youtube.com/watch?v=LrnbAbaG3Ks
Although it's not secret but sorry that the how-to instruction is not yet available now. I have to fix something first. I hope that I will finish it in next few days.
Thanks,
Sittiphol Phanvilai
DroidSans.com
nuuneoi said:
As all of you know that G1 have accelerometer but so pity that it doesn't come with Auto Rotate Screen function.
So I modified its source code for a little bit. And at last, I can bring the auto rotate screen function to G1 already. Please take a look.
http://www.youtube.com/watch?v=LrnbAbaG3Ks
Although it's not secret but sorry that the how-to instruction is not yet available now. I have to fix something first. I hope that I will finish it in next few days.
Thanks,
Sittiphol Phanvilai
DroidSans.com
Click to expand...
Click to collapse
Interesting, before we had root, I tried to write an AutoRotate application. But I kept getting an access denied when accessing "SURFACE_FLINGER".
Do u need a modified rc30 or earlier fw to do this?
dwang said:
Do u need a modified rc30 or earlier fw to do this?
Click to expand...
Click to collapse
Yes.
Darn, my g1 has rc30
I bet this will be a setting once they get the virtual keyboard out. If you think about it right now in landscape it requires you to use the keyboard. Until the Virtual Keyboard we still have to open up the screen to type or do anything with inputs (dial)
thats some pretty good progress..i guess then we can have keypad layout for landscape mode too..and other optimizations
dwang said:
Darn, my g1 has rc30
Click to expand...
Click to collapse
+1
(too short)
dwang said:
Darn, my g1 has rc30
Click to expand...
Click to collapse
To that end, are there any plans (or is it possible) to gain root with an OTA RC30? I am i the same boat as this guy.
vertigo1 said:
To that end, are there any plans (or is it possible) to gain root with an OTA RC30? I am i the same boat as this guy.
Click to expand...
Click to collapse
The very moment someone has even the slightest hint of an exploit to regain root in RC30, i'm sure there will be a thread about it on this very forum.
Awesome work! I'm looking forward to a release version. I naturally grab the phone in Landscape mode most of the time, so this will be perfect when I don't want to open the screen, but still want to read an email.
I have a feeling the lack of this functionality out-of-the-box has more to do with patents than anything else.
Good work! Cant wait to get this working on my g1!
Returned my g1 (with orig rc30) and got one with rc19. Just loaded up the new g1 with the hacked rc30. Looking foward to the auto rotate functionality!
if you download the app named Qsearch from the market, it auto rotates !!!!!
Let's see some .diff's
I figured out how to make the screen autorotate this afternoon. I'll create an app that polls the accelerometer to watch for rotations, and publish the code tonight.
The function you guys are interested, the APIs you need is Surface.setOrientation, and also IWindowManager.setRotation. For example:
Surface.setOrientation(Display.DEFAULT_DISPLAY, Surface.ROTATION_270);
mWm.setRotation(Surface.ROTATION_270, true);
I modified the "monkey" application to test my results. You won't have permission to ACCESS_SURFACE_FLINGER unless the application is a jar contained in /system/framework.
I wonder if there is a way for the rotation hardware to send an event to your application.
Maybe there is a way for your application to register with the accelerometer so that it can receive notifications.
Polling just seems inefficient, especially given how bad the battery life is on the g1.
Well. It works. Sort of. Clicking on items on the screen is messed up. It doesn't seem to know where stuff is positioned. I have another idea though.
Code:
/**
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
package com.android.commands.rotate;
import android.view.IWindowManager;
import android.view.Surface;
import android.os.ServiceManager;
/**
* Application that injects random key events and other actions into the system.
*/
public class Rotate
{
static void showUsage()
{
System.out.println("Valid usage:");
System.out.println(" rotate 0");
System.out.println(" rotate 90");
System.out.println(" rotate 180");
System.out.println(" rotate 270");
}
static void rotate(int rotateVal) throws Exception
{
Surface.setOrientation(Display.DEFAULT_DISPLAY, rotateVal);
IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
wm.setRotation(rotateVal, true);
}
public static void main(String[] args)
{
if (args.length != 1)
{
showUsage();
return;
}
try
{
if (args[0].equals("0"))
{
rotate(Surface.ROTATION_0);
}
else if (args[0].equals("90"))
{
rotate(Surface.ROTATION_90);
}
else if (args[0].equals("180"))
{
rotate(Surface.ROTATION_180);
}
else if (args[0].equals("270"))
{
rotate(Surface.ROTATION_270);
}
else
{
showUsage();
}
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
}
}
Koush said:
Well. It works. Sort of. Clicking on items on the screen is messed up. It doesn't seem to know where stuff is positioned. I have another idea though.
Code:
/**
** Copyright 2007, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
package com.android.commands.rotate;
import android.view.IWindowManager;
import android.view.Surface;
import android.os.ServiceManager;
/**
* Application that injects random key events and other actions into the system.
*/
public class Rotate
{
static void showUsage()
{
System.out.println("Valid usage:");
System.out.println(" rotate 0");
System.out.println(" rotate 90");
System.out.println(" rotate 180");
System.out.println(" rotate 270");
}
static void rotate(int rotateVal) throws Exception
{
Surface.setOrientation(Display.DEFAULT_DISPLAY, rotateVal);
IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
wm.setRotation(rotateVal, true);
}
public static void main(String[] args)
{
if (args.length != 1)
{
showUsage();
return;
}
try
{
if (args[0].equals("0"))
{
rotate(Surface.ROTATION_0);
}
else if (args[0].equals("90"))
{
rotate(Surface.ROTATION_90);
}
else if (args[0].equals("180"))
{
rotate(Surface.ROTATION_180);
}
else if (args[0].equals("270"))
{
rotate(Surface.ROTATION_270);
}
else
{
showUsage();
}
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
}
}
}
Click to expand...
Click to collapse
Will u be addn this to the market like ur other apps ?
Related
Beta-Version is out!!
Multitouch for everyone!!!!
HD2Multitouch is for all who want to support multitouch on the HD2 in their apps like the Album-App does.
This is the really first version, so don't expect a perfect solution....
And it's free, so start developing....
Getting started:
Code:
public YourForm()
{
InitializeComponent();
bool doRestart;
multitouch = Multitouch.GetMultitouch(this, out doRestart);
if (doRestart)
{
MessageBox.Show("To activate the multitouch, the app will perform a restert now.", "Multitouch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
Multitouch.PerformSoftReset();
this.Close();
return;
}
if (multitouch == null)
{
MessageBox.Show("Failed to initialize the multitouch.", "MultitouchDemo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
this.Close();
return;
}
multitouch.TouchDown += new EventHandler<MultitouchEventArgs>(multitouch_TouchDown);
multitouch.TouchUp += new EventHandler<MultitouchEventArgs>(multitouch_TouchUp);
multitouch.TouchMove += new EventHandler<MultitouchEventArgs>(multitouch_TouchMove);
multitouch.EnableEvents = true;
}
Please note (if you download the app you agree!):
The SDK is provided 'as is'
The developer does NOT give any warranty of any kind and can't be held for any damage or loss caused directly or indirectly by the SDK (just in case)
The developer does NOT guarantee any kind of support (but I'll try to help everyone )
You're not allowed to develope commercial apps with this sdk. Your app and the sdk MUST be sold free. For commercial prjects contact the developer.
You are not allowed to disassemble the SDK or reverse engineer it.
you are not allowed to post the attachement(s) below to any other website. you can always link to this tread.
If you are going to use it in your application, you MUST put a link in your application/offical website that reffers to this XDA thread.
The developer reserves the right to make this a paid SDK at any point of time.
The developer reserves the right to relocate this SDK to another website or even take it offline.
Reserved for futere posts...
Reserved. (the last one)
hi Dude...i am a very newbies for this and i own a hd2...
i had download the file and now how i suppost to do? where i should i put the file??
Thanks...
sorry for a stupid question...
Hey
I'm not sure what you're trying to get. The file you downloaded is a sdk (which means software development kit), so it's meant to use it in your own project, but if you aren't a developer, there's no need for the sdk on your hd2...
Cheers
Hi, this is my first thread, I want to record a call in my app.
Can anyone help me with this task?
I have some code, but the file created by de recorder is empty.
Thanks!
some help
can anyone help me?, please!
first of all what's the phone you have and what's android version you use? i know that call record possible only from 2.3.3 and not on all kernels
I'd like to know this too
I use the one of the bigest russian sites 4PDA, and see that you need custom kernel with recording option: that you can to use aftermarket app. http://forum.xda-developers.com/showthread.php?t=488475
well, the thing is I need to make a recording app, but the code get stack in the record state, like a loop, and the activity don't refresh
it's a dev problem. if anyone have some code of info, post it please!
thanks a lot!
need a brainstorm or a good teacher
last chance to this thread...
some android dev to help me?
Although it might be a problem with your code at the moment, it ultimatively is a problem with the kernel.
The android api natively allows you to use i.e. a MediaRecorder and just select the call as source.
BUT on most kernels it doesn't work because it is intentionally crippled by the manufactor to avoid legal problems.
That being said, how can anyone help you with your code, if you don't show it.
I use a good aplication to record all the calls in my android phone. The aplication is CallRecorder 1.0.43 alpha. It's perfect for me in my hd2 with a TBD 3.5 room. In a other sites i see another version 1.1.5 trial, but i don't wannna change the things working good.
Dark3n said:
Although it might be a problem with your code at the moment, it ultimatively is a problem with the kernel.
The android api natively allows you to use i.e. a MediaRecorder and just select the call as source.
BUT on most kernels it doesn't work because it is intentionally crippled by the manufactor to avoid legal problems.
That being said, how can anyone help you with your code, if you don't show it.
Click to expand...
Click to collapse
U r right Dark3n...here is...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this._fileTrace = new FileTraceListener();
try {
File myNewFolder = new File(REPOSITORY + "/logs/");
if (!myNewFolder.exists())
myNewFolder.mkdirs();
this._logFileName = "/calldate" + sdf.format(c1.getTime()) + ".log";
this._fileTrace.open(myNewFolder.toString() + _logFileName);
} catch (Exception exc) {
exc.printStackTrace();
this._fileTrace.close();
this._fileTrace = null;
}
}
protected void onResume() {
super.onResume();
setContentView(R.layout.testcallactivity);
try {
_CurrTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
} catch (Exception exc) {
exc.printStackTrace();
}
phoneListener = new PhoneStateListener() {
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
if (call) { //call is a boolean
recorder.stop();
recorder.release();
}
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
call = true; recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL); recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(REPOSITORY + "/calls/audio.3gp");
recorder.setMaxDuration(30000);
try {
recorder.prepare();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
recorder.start();
break;
case TelephonyManager.CALL_STATE_RINGING:
if (call) {
recorder.stop();
recorder.release();
}
break;
}
}
};
_CurrTelephonyManager.listen(phoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
}
Thanks!
Well yeah... No...
Post here, post link
https://gist.github.com/
Dark3n said:
Well yeah... No...
Post here, post link
https://gist.github.com/
Click to expand...
Click to collapse
great web...
https://gist.github.com/1829663
thankz again!
Took a quick glance.
Looks okay, most likely what i already mentioned.
Code:
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
Your kernel has the VOICE_CALL crippled. You will need an uncrippled one for your device.
Dark3n said:
Took a quick glance.
Looks okay, most likely what i already mentioned.
Code:
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
Your kernel has the VOICE_CALL crippled. You will need an uncrippled one for your device.
Click to expand...
Click to collapse
this is the problem?
the statement recorder.play() stock becuase the kernel has the VOICE_CALL crippled, I try it in the AVD from Android SDK, you know if I can chance something to probe my code?
At the moment I try to change VOICE_CALL to MIC and post again whit the result
Thanks again men!
Well, I probe with MIC and DEFAULT, but the application still block in the recorder.start()
I'm going INSANE!!! LOL!
well, even if I made a simply record app, the statement recorder.start() still block my app.
some tips to this crazy bug?
Android Async TaskManager
AsyncTask is a great tool, allowing one to run background tasks while interacting with the UI before, while and after. However it does come with a few issues, mostly related to the way Android act when a user flips the screen or in other ways creates a detachment of the UI. AsyncTask is not equipped to handle these circumstances.
TaskManager is an extension of AsyncTask which fixes it's issues (Based on an idea of Santiago Lezica) and on top of that, provides additional features.
Source & Documentation
https://github.com/SpazeDog/taskmanager
Features
Makes sure that UI inteaction waits until the UI is pressent
Makes sure that flipping the screen does not produce multiple instances running the same tasks
Adds a new inteaction to AsyncTask onUIReady() and onUIPause() which is invoked whenever the UI is detached and re-attached
Compatible with both native fragments and the support library
Helper methods that makes it easy to use it in both Activities and Fragments
Deviates
Like mentioned above, this is based on the idea of Santiago Lezica whom made a pretty decent example. There was however a few things that bothered me, which made me decide to build my own from scratch.
The tasks should only be handled by the Task class and not be divided between the Task and the Manager. The Managers job should only be to keep track of the UI status and then report to the Tasks whenever this changes. It is then up to the Task what action should be taken depending on the current state.
I was missing the onUIReady() and onUIPause() methods which helps deal with attachment and detachment of the UI from within each individual task. Usefull to handle things like Progress Dialogs.
Using onActivityCreated() and onDetach() in the Manager does not work properly. They execute upon screen flip, but not on application pause and resume, which is also an attachment and detachment of the UI.
It is fine to include the AsyncTask onProgressUpdate() method, but without including publishProgress(), you can't really use it for anything.
The onPreExecute() method should be managed via the pending method like the rest of the methods, otherwise you will end up with a lot of application crashes.
If one should decide to built an application for newer Android versions only, there is no reason to use the support library, so there should be support for both.
I also wanted something that could return the current object. getActivity() is fine when working in an Activity, but this should also be able to run from within fragments. So a getObject() was added.
How it works
Take a look at Santiago's blog
Code:
public class MyActivity extends Activity {
private ProgressDialog mProgressDialog;
@[URL="http://forum.xda-developers.com/member.php?u=439709"]override[/URL]
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new Task<Context, Void, Boolean>(this, "nameOfMyAsyncLoader") {
@[URL="http://forum.xda-developers.com/member.php?u=439709"]override[/URL]
protected void onUIReady() {
((MyActivity) getObject()).mProgressDialog = ProgressDialog.show( (Activity) getActivityObject(), "", "Loading...");
}
@[URL="http://forum.xda-developers.com/member.php?u=439709"]override[/URL]
protected void doInBackground(Context... params) {
return someMethod( params[0] );
}
@[URL="http://forum.xda-developers.com/member.php?u=439709"]override[/URL]
protected void onPostExecute(Boolean result) {
((MyActivity) getObject()).mProgressDialog.dismiss();
if ( result ) {
...
} else {
...
}
}
}.execute( getApplicationContext() );
}
}
No mater if you execute this from within an Activity, Fragment or the same using the Support Library, you just parse this to the constructor. If you execute it from within a fragment, you need to make sure that you parsed a Tag Name when you added it with FragmentManager. TaskManager does not save instances of the object you parse, it just saves the information needed for it to find it again. With fragments, this means Tag Names. Without it, getObject() will return NULL on Fragments.
Download Pre-built Jar
2.0.2 (2013-06-28) (MD5: 88dbced8ebc4db9dea1b9cf12ab0da40)
[Default Mirror] SourceForge.net
According to Linux Journal, these BNTV450 devices have ADUPS Android Malware.
ref: linuxjournal.com/content/adups-android-malware-infects-barnes-noble (sorry account too new to embed link)
EDIT (12 Jan 2017): An OTA update may have removed threat: androidcentral.com/update-50-nook-tablet-removes-factory-malware-you-still-shouldnt-buy-it
But, is still 100% vulnerable to CVE-2015-6616 or the Stagefright exploit...
Allegedly they are releasing, (or maybe have released in this latest update?) a patch to remove ADUPS. Can anyone with the latest OTA confirm?
Source: https://nakedsecurity.sophos.com/20...d-to-neutralise-adups-fear-says-barnes-noble/
So according to the Android Central article posted by koickxda, it says you still shouldn't buy these. And even though B&N claims that the ADUPS malware has been taken care of, and blah blah blah, I'm still concerned.
Would the malware be completely gone if we flashed a custom ROM? Could we remove ADUPS completely with root access? But, alas, we have neither of those, so that won't lead anywhere. I thought about returning the Nook in the wake of the adapter recall (they accept refunds until the end of February). But I called them, and they confirmed that I would receive a refund in the same way I paid. Which means B&N gift cards. And that isn't helpful if I want to get a Fire Tablet 7" instead.
But besides, there's no LineageOS build for the Fire 7. Nor is there for TWRP. So that might not be a good option either. I don't want FireOS, and I certainly don't want lockscreen ads. (*Ahem,* "Special Offers")
What do you guys think? Is it really a big deal? Is it critical enough that I should I get a refund and (and fork out more money) buy a Samsung Galaxy Nook instead? Like, my info is already on the device, and was probably sent to Chinese servers already, if it was going to. Not that I'm OK with that, but I don't know what to do.
A bit late, but now that we have root access (from this thread) I took a deep look at the software of this device (I was cleaning off all the Nook junk). On my tablet, there was no trace of ADUPS, and there appeared to be a package ("com.emdoor.cleaner") whose job was clearly to remove this. I'll let the disassembled code from it do the talking:
Code:
package com.emdoor.cleaner;
import android.app.Service;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.IBinder;
public class CleanService extends Service {
public IBinder onBind(Intent intent) {
return null;
}
public void onCreate() {
super.onCreate();
}
public int onStartCommand(Intent intent, int flags, int startId) {
try {
PackageManager pm = getPackageManager();
pm.deletePackage("com.adups.fota", new PackageDeleteObserver(), 0);
pm.deletePackage("com.adups.fota.sysoper", new PackageDeleteObserver(), 0);
} catch (Exception ex) {
ex.printStackTrace();
}
return super.onStartCommand(intent, flags, startId);
}
}
So, this is basically a question about where i should best find my solution in this forum, im making an app (just for learning purposes) and wanted to know where i should post about that question as well. This app should only open a website in WebView, and i got that far, now i want to announce something on the website that is excluded with some CSS maybe display: none; for example.
How do i do that? I have been looking for a way to modify the CSS (This announcement is all about the app) contained in a div with a class and an id to make it easier to make that connection. (I own the website and got full control over the files on the server side.)
Bare with me, this is the first time developing anything for android ^^ Thanks!
EDIT: Just because i wrote here i found something interesting in this subject, unfortunatly it's getting late here so ill have to come back tomorrow morning an fill you in. ^^ any suggestions are still appreciated.
So i found this:
public class MyWebClient extends WebViewClient {
@override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@override
public void onPageFinished(WebView view, String url) {
view.loadUrl("document.getElementsByClassName('someClass').style.display = 'none'");
}
}
.........
final MyWebClient myWebViewClient = new MyWebClient();
mWebView.setWebViewClient(myWebViewClient);
to probably do what i asked for. any suggestions?