Novice neighborhoods broadcast problem. InstallReceiver receiver = new InstallReceiver (); IntentFilter filter = new IntentFilter (); registerReceiver (receiver, filter);
class InstallReceiver extends BroadcastReceiver { @ Override public void onReceive (Context context, Intent intent) { / / TODO Auto-generated method stub if (intent.getAction (). equals (Intent.ACTION_PACKAGE_ADDED)) { String packName = intent.getDataString () substring (8);.
System.out.println (packName);
} } }
What is the problem you wrote, did not reflect the final broadcast ah. Reply: Registered receiver to determine whether the dynamic success. Reply: IntentFilter filter = new IntentFilter (Intent.ACTION_PACKAGE_ADDED) Reply:
How this determination ah. . Reply:
You are using the manual registration method, you can first determine whether increased ACTION filter, see I give you the code Reply:
Registered receiver to determine whether the dynamic success.
How this determination ah. .
You are using the manual registration method, you can first determine whether increased ACTION filter, see I give you the code
I tried the code you gave me, or did not come out ah. . Reply: androidMANIfest.xml code put out look Reply:
androidMANIfest.xml code put out look
Amount, the authority to add it? Reply:
androidMANIfest.xml code put out look
Amount, the authority to add it?
Must first register here, then need to add permissions must add permissions But you are dynamic registration, you do not register here Reply:
Reply Quote 6th Floor siyehua of::
androidMANIfest.xml code put out look
Amount, the authority to add it?
Must first register here, then need to add permissions must add permissions But you are dynamic registration, you need to register
hereYes, ah, I do not need registration manifest ah, I see no need to add anything like this permission, do not know where the problems. . Reply: I know, I recently wrote a lot of radio. I usually write so private InstallReceiver receiver; private IntentFilter filter;
Amount is still the same, the problem is actually upstairs has let me add too, still the same. . This notification means that the application will play packName slightly Bahrain? But that did not come out ah, Reply: From the top, and then seek expert help facie ah. Reply:
from the top, and then seek expert help facie ah.
I did not carefully look at your code, I found you have not solved, you're missing a step, that you here IntentFilter filter = new IntentFilter (); registerReceiver (receiver, filter); Should be so written:
IntentFilter filter = new IntentFilter (); / / Put this Action added filter.addAction (Intent.ACTION_PACKAGE_ADDED); registerReceiver (receiver, filter);
Reply: Upstairs say to add this: filter.addAction (Intent.ACTION_PACKAGE_ADDED);
Almost, you look at the demo on sdk broadcast this one, compare their Reply:
I know, I recently wrote a lot of radio. I usually write so private InstallReceiver receiver; private IntentFilter filter;
Amount is still the same, the problem is actually upstairs has let me add too, still the same. . This notification means that the application will play packName slightly Bahrain? But that did not come out ah,,
You see log, usually with log.i (TAG, name); Look, if System.out.println (name); want to add the filter in logcat as, name: System.out TAG: System.out see here print the results, the console can not see, do not know will not be a problem. Or print the next level of data to see the broadcast has not received, or data problems, and there did not send broadcasts.
Reply:
I know, I recently wrote a lot of radio. I usually write so private InstallReceiver receiver; private IntentFilter filter;
Amount is still the same, the problem is actually upstairs has let me add too, still the same. . This notification means that the application will play packName slightly Bahrain? But that did not come out ah,,
You see log, usually with log.i (TAG, name); Look, if System.out.println (name); want to add the filter in logcat as, name: System.out TAG: System.out see here print the results, the console can not see, do not know will not be a problem. Or print the next level of data to see the broadcast has not received, or data problems, and there did not send broadcasts.
Well, I registered in the manifest, and be able to successfully play out, this registration code will not work. . . Should not be the reason you say it. . Feel should be registered wrong, do not know what wrong. . Reply: To accept this system broadcasts not only to add permissions, plus action dynamic registration, but also add setData (); in this property android configuration file: scheme = "package" Reply:
to accept this system broadcasts not only to add permissions, plus action dynamic registration, but also add setData (); in This configuration file attributes android: scheme = "package"
You're like a little truth, dynamic registration should android: scheme = "package" added Where ah? Reply: Plus filter.addDataScheme ("package"); After resolving the matter, thank you ah!
No comments:
Post a Comment