Friday, 9 August 2013

Waiting for Broadcast receiver message in android

Waiting for Broadcast receiver message in android

I am new to Java and android development. Currently i am developing an
android libray which talks with the usb device using USBHost and USB OTG
Cable.To open the device for communication i required the permission from
the user.So i am using requestPermission API which display a dialog.When
user accepts or rejects the request my application will get a broadcast
receiver message. Every thing is fine till now. Now the problem is, I want
to export an Function say, OpenDevcice() whose return value should say
wether the device is opened or not (got permission or not). But the
requestPermission is not a blocking call, i am not able to return the
proper return value.Is there any way i can wait in OpenDevcice API until
the broadcast message comes?

No comments:

Post a Comment