tags:

views:

44

answers:

1

I have an existing app that was working just fine on all phones.
I added the permission WAKE_LOCK so I could control when the app goes to sleep.
It worked fine on my HTC Hero, so I published the new update. I immediately started getting emails from Droid users that the app would not launch anymore on their phones after they udpated. They get "could not launch requested activity" when the try to start the app, but it will allow them to run the app once if they run it from the App Store button.
I removed the permission, and now Droid users can run the app normally.
Here is my manifest xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.krugism.EntitySensor"
     android:versionName="2.8" android:versionCode="12">
   <application android:icon="@drawable/icon"
       android:label="@string/app_name" android:debuggable="false"
       android:permission="android.permission.WAKE_LOCK">
       <activity android:name=".EntitySensor"
                 android:label="@string/app_name"
                 android:screenOrientation="portrait"
                 android:permission="android.permission.WAKE_LOCK">
           <intent-filter>
               <action android:name="android.intent.action.MAIN" />
               <category android:name="android.intent.category.LAUNCHER" />
           </intent-filter>
       </activity>
       <activity android:name=".SettingsPref" android:label="@string/app_name">
       </activity>
   </application>
       <uses-sdk android:minSdkVersion="3"     />
       <uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>

Any ideas why this would be a problem on Droid phones? I have not heard of any other phones having this problem.
Thanks, Scott

A: 

Remove all occurrences of:

android:permission="android.permission.WAKE_LOCK"

from your manifest. You do not need those. You do not want those. You do need your <uses-permission android:name="android.permission.WAKE_LOCK" /> element, though.

CommonsWare
I was using the WakeLock with the PowerManager, but now I'm using the "setKeepScreenOn" method of the view. It seems to work much better. Thanks.
TheTall
@TheTall: Oh, yeah, for GUIs, definitely use `setKeepScreenOn()` (or the equivalent `android:keepScreenOn`) -- much simpler and much less likely to accidentally fail to release the `WakeLock`.
CommonsWare