Running a Android App while the screen is black

I'm trying to run a android app while the screen is black, i used a service and i tryed to add also a WakeLock of the type "PARTIAL_WAKE_LOCK".

The service play a song and save data from the accelerometer to the db, but when i press the red phone button to make the screen black, it play the song but it don't save data to the db. Have anyone a idea of why it don't save data to the db?



-------------Problems Reply------------

With this you ensure that the code between acquire() and release() are executed even if the phone is in stanby mode, since the cpu will stay active.

PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
..CPU will stay on during this section..

Category:android Views:1 Time:2010-08-25

Related post

  • Install and Run the android app in the higher version? 2011-07-29

    Is it possible to run the android app in higher version ? if i create any app using the API level 7 and try to run it on API level 8 or 9 does not show the AVD(emulator) of that API level in the run Target..How can i make an app which will insta

  • How do I make my android apps fill the screen on Honeycomb? 2011-04-02

    I just got a Xoom on Wednesday, and upon loading my apps onto it, they run in a small window, as if they are being run on a smaller device. Various other apps fill the screen of the Xoom, although they don't seem to be using any specific honeycomb AP

  • Running Code On First Run of Android App 2010-08-15

    I have a new earthquake notification android app thats in it's initial release version. I have a problem currently. My app has a service running in background, this schedules itself to run every X period. To schedule itself it needs to run atleast on

  • Problem Filtering android app based on screen resolution 2011-01-11

    I want my app to be shown in the Market, only for devices with large screen. i.e WVGA800 (480x800, 480x850). Example: Nexus One. I have done following changes in the Manifest file. <supports-screens android:anyDensity="true" android:largeScreens="

  • Running another android app from my app? 2011-07-18

    When I press a button I want to run another separate app I made, but I want to somehow package these two apps together so the user only needs to download one app. I'm aware of starting an intent like this: Intent intent = new Intent(Intent.ACTION_MAI

  • Air for Android app is keeping screen awake when not in app 2011-08-07

    I have an air for android app that has event listeners for ACTIVATE and DEACTIVATE, inside the activate I tell the screen to stay awake and in the deactivate I tell it to go back to normal like so : stage.addEventListener(Event.DEACTIVATE, deactivate

  • User authentication web service code not running from Android app 2011-08-14

    I am facing a problem in calling my web service for user authentication from within my Android app. When I enter the user name and password that I know are right, it is giving me a weird xml error on the emulator screen Here is my Android code : pack

  • Run/Compile Android app in Linux 2011-12-19

    Although I have some experience in Android development, I don't have a lot of experience with linux systems. I have an Android application and I would like to know if it is possible to compile and/or run it on a Linux system. If it is possible, what

  • How to run an android app in background? 2012-01-27

    This code will run an app automatically after booting the system, but the app will close after pressing the back button. If the app is run normally by clicking it's icon. It will continuously run even after pressing the back button or running other a

  • "java.lang.InstantiationException" when running an Android app 2012-04-08

    Below is the log of my example app TodoListItemView. I´m sorry for writing so much code but I don´t know why it doen't work. 04-08 16:46:23.023: D/AndroidRuntime(3167): Shutting down VM 04-08 16:46:23.023: W/dalvikvm(3167): threadid=1: thread exiting

  • manually opening ports on windows 7 64 bit to run emit android app and emit server on windows? 2011-10-29

    How should I manually open ports TCP 1554 and udp 2000-2006 for IP . I have a Windows 7 64 bit Home Premium and a i5 processor laptop. I want to do this in order to use the Emit Android app and the server software for Windows. Whenever I

  • How does the Facebook for Android app's home screen widget work? 2010-02-05

    Actually this question applies to any widget that requires data from a remote server. The answer would be pure speculation, but how do you think the widget gets its data? For those that don't know, the widget shows a history of your friends' latest s

  • newbie: How to run my android app on a real tablet device? 2011-06-29

    I use eclipse + ADT (andoid development tool) plugin to develop my android application. I know during my development, I can run my application either on an emulator, or an android phone device(with data cable connected to my laptop). BUT, now, I woul

  • Eclipse launch error when trying to run an Android app 2010-01-26

    I'm trying to set up my workstation for Android development with Eclipse Galileo. I installed the latest ADT plugin and the Android SDK, but I get this error when I try to run any basic Android project I create. eclipse.buildId=M20090917-0800

  • Eclipse fail to build and run the android App 2011-07-15

    When first I use to run android project in automatically upload the apk file and run it. It worked for a week. Now when I run a project , the console inform me that the .apk is uploaded and installed but when I run the app. in android emulator , its

  • running an android app on IntelliJ 2011-08-21

    I have IntelliJ IDEA 9 setup successfully including all the Java SDKs necessary and the Android SDK too. I created a simple project and to run it, I went to the Configurations to setup a virtual device. Device was created successfully but when I'm tr

  • Android: how to know what is the minimum required API to run my Android app? 2011-08-23

    As everybody, I use in my project many libraries and methods. For each method, it is mentioned "Available since API XX" in the Android documentation. Is there a tool in Ecplise to know what is the minimum API required to run my project ? (without hav

  • Android app loading white screen on device 2011-11-30

    I've debugged my app on my PC and it works fine. When I go into my phone and tablet instead of it loading the WebView like it should it simply loads a white screen, I guess failing to load the web site. I'm not sure where to begin debugging since my

  • How to run an android app on the device with ant 2012-01-26

    I would like to be able to launch my app after installation with ant just as happens when pressing the run button in eclipse. Is there an existing ant task after creating a project on the command line or is there a command I could execute with ant? -

Copyright (C), All Rights Reserved.

processed in 0.180 (s). 11 q(s)