p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 (http://p2p.wrox.com/forumdisplay.php?f=432)
-   -   Chapter 8 example 4 (http://p2p.wrox.com/showthread.php?t=71839)

mobilekid December 16th, 2008 09:20 AM

Chapter 8 example 4
 
Hi,

I have problems running the fourth example from chapter 8. Basically, I have created a new project from the provided source, however, upon running it throws out the following message:

12-16 13:16:58.102: ERROR/AndroidRuntime(15341): java.lang.SecurityException: Requires VIBRATE permission
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at android.os.Parcel.readException(Parcel.java:1234)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at android.os.Parcel.readException(Parcel.java:1222)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at android.app.INotificationManager$Stub$Proxy.enqueu eNotification(INotificationManager.java:152)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at android.app.NotificationManager.notify(Notificatio nManager.java:96)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at com.paad.earthquake.EarthquakeService.announceNewQ uake(EarthquakeService.java:167)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at com.paad.earthquake.EarthquakeService.addNewQuake( EarthquakeService.java:124)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at com.paad.earthquake.EarthquakeService.doRefreshEar thquakes(EarthquakeService.java:251)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at com.paad.earthquake.EarthquakeService.access$0(Ear thquakeService.java:190)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at com.paad.earthquake.EarthquakeService$1.run(Earthq uakeService.java:186)
12-16 13:17:58.580: ERROR/AndroidRuntime(15353): at java.lang.Thread.run(Thread.java:935)

Could you please suggest how to fix that? Thank you.

Reto December 16th, 2008 09:41 AM

Looks like it's missing the permission required for an application to vibrate the device.

Add the following line at the end of your application manifest, before the closing </manifest> tag:
Code:

<uses-permission android:name="android.permission.VIBRATE"/>
Let me know if this solves the problem for you!

For my own benefit, when you say you created a new project from the provided source, are you referring to the source code download? If so I'll update it to make sure it's got the right permissions so others don't have the same problem.

----
Reto Meier
Author, Professional Android Application Development

mobilekid December 16th, 2008 09:57 AM

Quote:

Originally Posted by Reto (Post 231650)
Looks like it's missing the permission required for an application to vibrate the device.

Yes, that was it. The declaration in the manifest fixed it.

And, yes, I built it from the source code I downloaded from the book's website, it really should be updated the way you suggested.

Thanks for the help!

PS: Great book! The best Android book I've seen so far!


All times are GMT -4. The time now is 07:18 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.