Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Newbie question - permission issue trying to utilize Bluetooth on I-Jetty for Android

Hi everyone.  I’m brand new to web technologies AND android, so I appreciate your kindness if my questions are particularly ignorant. J

 

I’ve been able to set up some simple Java Servlets using I-Jetty for Android, and now I’m trying to utilize the Bluetooth services so I can effectively use the I-Jetty server as a “bridge” to a Bluetooth device.

 

Currently I’ve run into this problem and I’m stuck – any help would be appreciated.  (FYI – I’ve been able to utilize Bluetooth in Beanshell using the PAW server, so I know its technically possible to do this in Android.  I’m not sure what kind of “magic” PAW uses to make this possible, though – does the I-Jetty manifest need to be recompiled to get Bluetooth permissions or something like that??)

 

HTTP ERROR 500

Problem accessing /BtDemo6/servlet. Reason:

    Need BLUETOOTH permission: Neither user 10077 nor current process has android.permission.BLUETOOTH.

Caused by:

java.lang.SecurityException: Need BLUETOOTH permission: Neither user 10077 nor current process has android.permission.BLUETOOTH.
        at android.os.Parcel.readException(Parcel.java:1425)
        at android.os.Parcel.readException(Parcel.java:1379)
        at android.bluetooth.IBluetooth$Stub$Proxy.isEnabled(IBluetooth.java:550)
        at android.bluetooth.BluetoothAdapter.isEnabled(BluetoothAdapter.java:446)
        at BtDemoServlet.doPost(BtDemoServlet.java:46)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:479)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:483)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:227)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1031)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:406)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:965)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
        at org.eclipse.jetty.server.Server.handle(Server.java:349)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:449)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:910)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:647)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:233)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:615)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
        at java.lang.Thread.run(Thread.java:856)

Powered by Jetty://

 

Here’s an excerpt of the relevant code in the servlet:

 

import android.bluetooth.*;

  import android.os.*;

  import android.content.*;

  import java.io.*;

  import java.util.*;

  import javax.servlet.*;

  import javax.servlet.http.*;

  import android.app.*;

  import android.view.*;

  public class BtDemoServlet extends HttpServlet

  {

  

      protected void doPost(HttpServletRequest req, HttpServletResponse resp)

          throws ServletException, IOException

      {

         BluetoothAdapter mBluetoothAdapter;

 

          PrintWriter out = resp.getWriter();

 

          out.println("<html>");

          out.println("<body>");

 

          mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();

 

          if (!mBluetoothAdapter.isEnabled()) //This is the line that causes the error

          {

          }

      }

  }

 

  

  




[CONFIDENTIALITY AND PRIVACY NOTICE] Information transmitted by this email is proprietary to Medtronic and is intended for use only by the individual or entity to which it is addressed, and may contain information that is private, privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please delete this mail from your records. To view this notice in other languages you can either select the following link or manually copy and paste the link into the address bar of a web browser: http://emaildisclaimer.medtronic.com


Back to the top