Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8830391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:04:31+00:00 2026-06-14T08:04:31+00:00

I am having an app where an alarm needs to play on a time

  • 0

I am having an app where an alarm needs to play on a time value stored in the database.When i remove the statement “notification.defaults=Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE;”,a notification appears on that alarm time without playing an alarm.when i insert the above statement alarm plays following by force clossing my application.My alarm class is following:

public class AlarmManager extends BroadcastReceiver {

sampleDatabase appdb;
SQLiteDatabase sqldb;
Cursor cursor;
int today,prev;
Intent in;

@Override
public void onReceive(Context context, Intent intent)
{
    NotificationManager manger = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    Notification notification = new Notification(R.drawable.icon , "Yahrzeit" , System.currentTimeMillis());
    in = new Intent(context,FirstAppActivity.class);
    in.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, in, 0);
    notification.setLatestEventInfo(context, "ALERT!!!!", "Time Over" , contentIntent);
    notification.defaults=Notification.DEFAULT_SOUND|Notification.DEFAULT_VIBRATE;
    notification.flags = Notification.FLAG_INSISTENT;
    appdb = new sampleDatabase(context);
    sqldb = appdb.getReadableDatabase();
    cursor = sqldb.query(sampleDatabase.TABLE_SEC, null, null, null, null, null, null);
    cursor.moveToFirst();
    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.SECOND, 0);
    today = (int)(cal.getTimeInMillis()/1000);
    Log.e("Naga","Alarm");
    Log.e("today",Integer.toString(today));
    prev = 0;
    cursor.moveToPrevious();
    while(cursor.moveToNext())
    {
        int dbdate = cursor.getInt(cursor.getColumnIndex(sampleDatabase.ALARMSET));
        int id = cursor.getInt(cursor.getColumnIndex(sampleDatabase.ROW_ID));
        Log.e("dbdate",Integer.toString(dbdate));
        if((dbdate<=today)&&(dbdate>prev))
        {
            manger.cancelAll();
            manger.notify(1, notification);
            sqldb.execSQL("DELETE from " + sampleDatabase.TABLE + " where " + sampleDatabase.ROW_ID + "=" + id);
            sqldb.execSQL("DELETE from "+sampleDatabase.TABLE_SEC + " where " + sampleDatabase.ROW_ID + "=" + id);

        }
        prev = dbdate;
    }
    cursor.close();
    sqldb.close();

}

My logcat view is like this(I have inserted permission for vibrate,then also this error comes.):

 11-14 18:09:18.000: ERROR/AndroidRuntime(757): FATAL EXCEPTION: main
 11-14 18:09:18.000: ERROR/AndroidRuntime(757): java.lang.RuntimeException: Unable to  start receiver com.nagainfo.firstAp.AlarmManager: java.lang.SecurityException: Requires VIBRATE permission
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2821)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.ActivityThread.access$3200(ActivityThread.java:125)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.os.Handler.dispatchMessage(Handler.java:99)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.os.Looper.loop(Looper.java:123)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.ActivityThread.main(ActivityThread.java:4627)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at java.lang.reflect.Method.invokeNative(Native Method)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at java.lang.reflect.Method.invoke(Method.java:521)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at dalvik.system.NativeStart.main(Native Method)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757): Caused by: java.lang.SecurityException: Requires VIBRATE permission
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.os.Parcel.readException(Parcel.java:1247)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.os.Parcel.readException(Parcel.java:1235)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:274)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.NotificationManager.notify(NotificationManager.java:110)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.NotificationManager.notify(NotificationManager.java:90)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at com.nagainfo.firstAp.AlarmManager.onReceive(AlarmManager.java:52)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     at android.app.ActivityThread.handleReceiver(ActivityThread.java:2810)
 11-14 18:09:18.000: ERROR/AndroidRuntime(757):     ... 10 more

Pls help me.
my manifest is:

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".FirstAppActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
            <activity android:name=".addtable"
                      android:label="@string/app_name">
              </activity>
              <activity android:name=".showTime"
                        android:label="@string/app_name">
              </activity>
              <activity android:name=".edittable"
                        android:label="@string/app_name">
              </activity>
               <receiver android:name="AlarmManager">
                </receiver>
              <uses-permission android:name="android.permission.READ_CALENDAR"/>
              <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
              <uses-permission android:name="android.permission.VIBRATE"/>
</application>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T08:04:33+00:00Added an answer on June 14, 2026 at 8:04 am
    Caused by: java.lang.SecurityException: Requires VIBRATE permission
    

    Add the VIBRATE permission to your manifest.

    <uses-permission android:name="android.permission.VIBRATE" />
    

    You have placed this tag within your application tag. It should outside the application tag. Like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    
        package="name.xml"
        android:versionCode="24"
        android:versionName="3.4" >
    
        <uses-sdk android:minSdkVersion="8" />
    
        <uses-permission android:name="android.permission.READ_CALENDAR"/>
        <uses-permission android:name="com.android.alarm.permission.SET_ALARM"/>
        <uses-permission android:name="android.permission.VIBRATE"/>
    
        <application android:icon="@drawable/icon" android:label="@string/app_name">
    
            <activity android:name=".FirstAppActivity"
                android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                   <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
    
           <activity android:name=".addtable"
                 android:label="@string/app_name">
            </activity>
    
            <activity android:name=".showTime"
                   android:label="@string/app_name">
            </activity>
    
            <activity android:name=".edittable"
                   android:label="@string/app_name">
            </activity>
    
            <receiver android:name="AlarmManager">
            </receiver>
    
        </application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a couple of problems with an alarm app I am developing. The
I am having an app in which at the time of launcing the app
I'm having an app(site), e.g. on Facebook, domain is mydomin.com . Just wondering if
Im attempting to style this plugin into my rails 3.2 app and having some
having a problem with a new ASP NET app and ASPNETDB Installed on existing
Having this errors when trying to compile/run my app using Maven. I've succeeded to
Im having 2 different languages in my rails app and would like to be
Having trouble framing this assertion in Rspec for my rails app. A User has
Im having a problem with my app that causes it to crash when no
In my iphone app i am having a button, when I click on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.