waleedAhmad1 / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

Problem with Registering Broadcast Receiver #644

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Register Broadcast Receiver with Manifest and it works. onReceive() is called 
when there is a new event.

Problems:
1.Register BroadcastReceiver dynamically with Context.registerReceiver(), it 
doesn't work. onReceive() is NOT called. 

2) When it works by registering IntentFilter in the Manifest, abortBroadcast() 
is NOT doing anything. Apparently, it is suppose to prevent Glass from taking 
picture or stop other codes from running but it doesn't. I think this is a bug 
in the new update. 

What is the expected output? What do you see instead?
1)  onReceive() is suppose to be called if there is a new event and it is not 
being called if registered dynamically on XE22. (Works on XE16 both through 
dynamic registering and Manifest).

2) abortBroadcast() is suppose to stop Glass from taking picture but it doesn't 
do that. (Works on XE16 but not on XE22)

3)Registering Broadcast Receiver with IntentFilter is suppose to detect new 
events coming to the intent but it doesn't do that. It does only if registered 
in the Manifest.

What version of the product are you using? On what operating system?
Glass 
Tried this on XE 19.1, and XE22 with the same result.

Please provide any additional information below.

I just did a quick downgrade to XE16 and it worked very well. The 
BroadcastReceiver API must have been broken after the XE16 Update and above. I 
went back to XE22 and it doesn't work. All those problem I mentioned above 
occurred. Something is wrong with registering Intent Receiver dynamically and 
abortBroadcast() doesn't work. Intent events are only received if registered in 
the Manifest(doesn't happen on XE16) but on XE19.2 and XE22. 

Here is the full code just in case you want to recreate the problem.
http://stackoverflow.com/questions/27387228/broadcastreceiver-onreceive-not-call
ed-when-registered-dynamically

Any temporary solution?

Original issue reported on code.google.com by innocla...@gmail.com on 12 Dec 2014 at 4:01