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

  • SEARCH
  • Home
  • 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 7823459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:15:12+00:00 2026-06-02T08:15:12+00:00

I have proximity alerts set up. (ADDED CRASH LOG) When the proximity alert fires,

  • 0

I have proximity alerts set up. (ADDED CRASH LOG)

When the proximity alert fires, I want a notification to load. Then when the user clicks the notification, a new activity/form should load.

Right now, the notification runs then the app crashes. The notification text is received and displayed successfully though.

Does anyone see something wrong with my code that would cause it to crash when firing the notification?

This code sets up the proximity alert/notification

    public void SetupProximityAlerts(LocationManager lm, String name, String info, double latitude, double longitude, int range)
{
    Intent intent = new Intent(PROX_ALERT_INTENT);
    intent.putExtra("Name", name);
    intent.putExtra("Info", info);

    PendingIntent pi = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);

    lm.addProximityAlert(latitude, longitude, range, -1, pi);
    IntentFilter filter = new IntentFilter(PROX_ALERT_INTENT);

    registerReceiver(new MyBroadcastReceiver(), filter);
}

And here is my BroadcastReceiver which sets the data to display in the notification. The app crashes when running: nm.notify(0, n);

Everything up until nm.notify(0, n); runs successfully. I’ve verified this with logging.

public class MyBroadcastReceiver extends BroadcastReceiver
 {

@Override
public void onReceive(Context context, Intent intent)
{
    Bundle extras = intent.getExtras();

    String deal = (String) extras.get("Info");

    Intent notificationIntent = new Intent(context, ViewTarget.class);
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);

    NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);

    Resources res = context.getResources();

    NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
    builder.setContentIntent(contentIntent).setSmallIcon(R.drawable.icon).setLargeIcon(BitmapFactory.decodeResource(res, R.drawable.icon)).setTicker(deal).setWhen(System.currentTimeMillis()).setAutoCancel(true).setContentTitle("Message")
            .setContentText(deal);
    Notification n = builder.getNotification();

    n.defaults |= Notification.DEFAULT_ALL;

    nm.notify(0, n);
}
}

And here is the activity I want to load when the user clicks the notification

public class ViewTarget extends ListActivity
{

@Override
public ListAdapter getListAdapter()
{
    // TODO Auto-generated method stub
    return super.getListAdapter();
}

@Override
public ListView getListView()
{
    // TODO Auto-generated method stub
    return super.getListView();
}

@Override
public void setListAdapter(ListAdapter adapter)
{
    // TODO Auto-generated method stub
    super.setListAdapter(adapter);

}

@Override
protected void onCreate(Bundle savedInstanceState)
{
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.locations);
    Log.v("db", "Inside ViewTarget");
}

}

Here is the crash log

04-17 21:53:52.407: E/AndroidRuntime(4717): FATAL EXCEPTION: main
04-17 21:53:52.407: E/AndroidRuntime(4717): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.kjdv.gpsVegas.MyBroadcastReceiver (has extras) } in com.kjdv.gpsVegas.MyBroadcastReceiver@44a4bc30
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:905)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.os.Handler.handleCallback(Handler.java:587)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.os.Looper.loop(Looper.java:123)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at java.lang.reflect.Method.invokeNative(Native Method)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at java.lang.reflect.Method.invoke(Method.java:521)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at dalvik.system.NativeStart.main(Native Method)
04-17 21:53:52.407: E/AndroidRuntime(4717): Caused by: java.lang.SecurityException: Requires VIBRATE permission
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.os.Parcel.readException(Parcel.java:1247)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.os.Parcel.readException(Parcel.java:1235)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:274)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.app.NotificationManager.notify(NotificationManager.java:110)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.app.NotificationManager.notify(NotificationManager.java:90)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at com.kjdv.gpsVegas.MyBroadcastReceiver.onReceive(MyBroadcastReceiver.java:51)
04-17 21:53:52.407: E/AndroidRuntime(4717):     at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)
04-17 21:53:52.407: E/AndroidRuntime(4717):     ... 9 more

Thanks!
Kevin

  • 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-02T08:15:13+00:00Added an answer on June 2, 2026 at 8:15 am

    Caused by: java.lang.SecurityException: Requires VIBRATE permission

    Did you forget a permission?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have set a notification when user enters in specific location. what happen when
Does windows phone currently have APIs for proximity and light sensors? I want to
We have a set of radio nodes in close proximity to each other and
I have followed this tutorial about how to use the proximity alert and how
I have a location listener which pops up an alert dialog on proximity. However,
I have registered ProximityAlert in MapActivity. No problem with catching alerts in BroadcastReceiver and
I have a geographic object that is used in proximity searches. That object is
Hy, I have a problem related to the proximity sensor. When I put the
I have a data set with latitude and longitude coordinates (two separate decimal columns).
I have a table of users that I want other users to be able

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.