2.1 Bluetooth support still needs work

by Anders Widen » Tue, 20 Apr 2010 20:28:45 GMT


Sponsored Links
 Hi!

I've been working with bluetooth trying figure things out using the
BTChatExample. Without editing BTChat has errors that destroy the
functionality. You can only connect the first time, if you connect.
Close the program and doesn't restart bluetooth the program crashes.
Even if you edit out the AccepThread and only focus on client connect,
the program will cast exceptions.

"JBtlSpp.create failed with status FAILED"

when trying to connect. I've looked into the code and referenced it
with the docs (that are based around the ChatExample) and either
bluetooth still needs work or there something missing in the APIs.

I would love to hear from other people trying to use Bluetooth on
Android 2.0++, or try to get a hold of a framework developer to try to
iron out these that I believe are in the framework itself.

--



2.1 Bluetooth support still needs work

by Max Gilead » Tue, 20 Apr 2010 21:07:06 GMT


 Hi Anders!

You can search list archives for others with BT-related issues. I for one am
having problems with it too (Droid with 2.0.1 firmware, still waiting for
OTA 2.1 update).

When every other phone/laptop I tried can connect to a device and even my
Droid can connect to is using low-level driver but it's plain impossible
from application level I'd say we have a bug here (full story @
 http://stackoverflow.com/questions/2660968/how-to-prevent-android-bluetooth-rfcomm-connection-from-dying-immediately-after 
)

Philipp's thread:


Sponsored Links


2.1 Bluetooth support still needs work

by ssozonoff » Tue, 20 Apr 2010 21:48:20 GMT


 Hello,

Yes I can confirm the same.

I have a solution working for example under the HTC Legend but fails
using the HTC Desire and the failure apears to be at a fairly low
level.

Serge



>



2.1 Bluetooth support still needs work

by DonFrench » Wed, 21 Apr 2010 03:43:43 GMT


 I have a similar problem and I suspect a timing problem.  In my case,
I have two seemingly identical devices and my Android Bluetooth app
can connect to one of them but not the other.  Both devices use the
same serial Bluetooth radio and everything else about the two devices
is identical.  I know this because I manufacture the devices.
Although my 2.1 Android app can only connect to one of these, my
Windows Mobile app can connect to both of them with equal ease.  The
only thing  that I can think that might be different is that maybe one
of the two devices takes slightly longer to respond to a connection
request and that the Android software simply gives up too soon.





> >



2.1 Bluetooth support still needs work

by Anders Widen » Wed, 21 Apr 2010 15:19:07 GMT


 I can connect to my PC and send and receive messages using SPP and a
terminal program. But restarting doesn't work and the connect doesn't
always work either:

1. Restarting (connecting) the program doesn't work without restarting
BT (Closing BTStack fails somewhere)
2. Sometimes when connecting, phone reads strings of length -1 and
loops a lot of output at Logcat about this.
3. When trying to connect to a bonded device the device name shows up
as "null". (After a restart of the program, guess it's related to 1.)

Anyone solved this issues?

--



Other Threads

1. Search Activity / Suggestion Provider affects Parent Activity Lifecycle

Note to moderator: I originally posted this 2 days ago, never showed
up. I can only assume it was rejected for some reason although I can't
figure out what. Any info would be appreciated...thanks.


Very strange problem that is driving me crazy.

We have implemented a SearchSuggestion provider and a Search activity
in our application. The one thing about it that is very odd is that if
the SearchManager passes control to our custom Search activity, AND
that activity does not create a *visible* Activity the Activity which
parented the search does not destroy (onDestroy doesn't run) and it
will not until we call a visible Activity from the parent activity.

As long as our Search Activity fires off another Activity that gets
focus the parent activity will fire onDestroy when I back out of it.
The trick is that Activity must have a visual component. I tried to
fake it out with a 'pass through' Activity so that my Search Activity
could fire off another Intent and bail out but that didn't work
either.

I have tried setting our SearchActivity to launch singleTop and I also
tried setting its noHistory attribute to true, tried
setResult(RESULT_OK) in SearchACtivity prior to finish, bunch of other
things, nothing is working.

This is the chunk of code in our Search Activity onCreate. Couple of
notes about it:

- If Intent is Action_Search (user typed in their own search and
didn't pick a suggestion), we display a list of results as our Search
Activity is a ListActivity. In this case when the item is picked, the
Search Activity closes and our parent Activity does fire onDestroy()
when we back out.

- If Intent is Action_View (user picked a suggestion) when type is
"action" we fire off an Intent that creates a new *visible* Activity.
In this case same thing, when we leave that new activity and return to
the parent activity, the back key does cause the parent activity to
fire onDestroy when leaving.

- If Intent is Action_View (user picked a suggestion) when type is
"pitem" is where the problem lies.
 It works fine (the method call focuses an item on the parent
activity), but when the back button
 is hit on the parent activity onDestroy is NOT called. IF after this
executes I pick an option in
 the parent activity that fires off another activity and return to
the parent then back out it will fire onDestroy()
 in the parent activity.

Note that the "action" intent ends up running the exact same method
call as "pitem", it just bring up a new visual Activity first. Also I
can take out the method call from "pitem" and just finish() and the
behavior is the same, the parent activity doesn't fire onDestroy()
when backed out of.


               if (Intent.ACTION_SEARCH.equals(queryAction)) {
                       this.setContentView(_layoutId);
                       String searchKeywords =
queryIntent.getStringExtra(SearchManager.QUERY);
                       init(searchKeywords);
               } else if(Intent.ACTION_VIEW.equals(queryAction)){
                       Bundle bundle = queryIntent.getExtras();
                       String key = queryIntent.getDataString();
                       String userQuery =
bundle.getString(SearchManager.USER_QUERY);
                       String[] keyValues = key.split("-");

                       if(keyValues.length == 2) {
                               String type = keyValues[0];
                               String value = keyValues[1];

                               if(type.equals("action")) {
                                       Intent intent = new
Intent(this, EventInfoActivity.class);
                                       Long longKey =
Long.parseLong(value);
                                       intent.putExtra("vo_id",
longKey);
                                 startActivity(intent);
                                 finish();
                               } else
                           if(type.equals("pitem")) {
                               Integer id = Integer.parseInt(value);

_application._servicesManager._mapHandlerSelector.selectInfoItem(id);
                               finish();
                           }


It just seems like something is being held onto and I can't figure out
what it is, in all cases the Search Activity fires onDestroy() when
finish() is called so it is definitely going away.

If anyone has any suggestions I'd be most appreciative.


Thanks,

Sean Overby

-- 

2. ContextMenu for WebView

servas,

i tried to implement a context menu for a webview, but could not
succeed, although my code works for buttons. i could not google any
useful source snippets, so it came in mind, that contextmenu's for
webview do not work???

i tried the following code:
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  WebView webview = new WebView(this);
  setContentView(webview);
  webview.setOnCreateContextMenuListener(new
OnCreateContextMenuListener() {
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
      menu.add(0, 1, 0, "TEST1");
      Log.d("TEST","CONTEXT1");
    }
  });
  webview.loadData(sHTML, "text/html", "utf-8");
}

does anyone have a working example of a contextmenu for webviews?????

a workaround i've found is webview.setOnTouchListener, and upon
MotionEvent.ACTION_UP I'm displaying a dialog. this is working, but
not a very fine method ...

ciao
  H.

-- 

3. Search Activity affects Parent Activity Lifecycle

4. How to send KeyEvents through an input method service to a Dialog, or a Spinner menu?

5. how to know when a map has been completely drawn

6. onListItemClick() not getting invoked on using CustomAdapter.

7. About DRM Permission Problem