#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    35
    Rep Power
    5

    Question SecurityException help


    Dear Friends,

    I am new in android and developing an autocall receive app . We have a basic code in github which work upto kitkat. It's url is : here

    But in between the code we get a security Exception like below:

    Code:
    W/System.err: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.HEADSET_PLUG from pid=9942, uid=10145
    This exception catch on following function

    private void broadcastHeadsetConnected(boolean connected) {

    Intent i = new Intent(Intent.ACTION_HEADSET_PLUG);
    i.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
    i.putExtra("state", 0);// connected ? 1 : 0);
    i.putExtra("name", "mysms");

    try {
    sendOrderedBroadcast(i, null);
    finish();
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    Please advise what may be the problem and possible solution.


    Thanks
    Anes
    Last edited by anes_pa; April 19th, 2017 at 06:32 AM.

IMN logo majestic logo threadwatch logo seochat tools logo