Why not ask for a permission for receiving? that's the same as there are permissions for reading contacts or call logs... the idea is to inform the user your app is doing something that they might not want to happen, like informing you the device just powered on which can be used to start an app without them knowing. Permissions aren't just for modifying things. You don't define permission for the broadcaster since that broadcast is a system broadcast...
On Monday, May 6, 2013 1:13:27 AM UTC+3, Palmer Eldritch wrote: > What confuses me really is that I request a permission for _receiving_ a > particular intent (whose action is boot_completed) - I do not define > anywhere a permission the _broadcaster_ must request/hold > > Thanks > > PS : testing vs asking - I found about the > android.intent.action.QUICKBOOT_POWERON permission while browsing for an > answer to this question - don't think I need it but added it :) > > On Monday, May 6, 2013 12:18:25 AM UTC+3, Piren wrote: >> >> I'm not 100% positive only the system can call it, but i'm pretty sure >> about it. It depands on the security level of that specific permission and >> these are not easy to find out (i can't recall any documentation that lists >> that.. i think it is only available in the source code). It's something >> that you need to remember, some of these calls can only be made by the >> system... some of these, were only blocked to be system only in later >> versions of android (and as usual, there's barely any documentation of >> these) so sometimes code that worked before, just stops working. >> >> To test Boot_Completed, just restart your device. that's why i did, >> that's also how i found our some HTC devices require you to also >> use "android.intent.action.QUICKBOOT_POWERON" (another tip ;-)) and don't >> forget you need the app to run at least once before (yet another tip :-D) >> >> If you want 0 warnings, tell the compiler to stop showing them :) >> >> >> On Sunday, May 5, 2013 11:07:12 PM UTC+3, Palmer Eldritch wrote: >> >>> >>> On Sunday, May 5, 2013 6:58:39 PM UTC+3, Piren wrote: >>>> >>>> Did you read the answer you quoted? >>>>> >>>>> "IF you didnt set any permissions for it." >>>> >>>> >>>> And back to my first answer, had you read the docs you would have seen >>>> this: >>>> >>>>> "The name of a permission that broadcasters must have to send a >>>>> message to the broadcast receiver. If this attribute is not set, the >>>>> permission set by the >>>>> <application><http://developer.android.com/guide/topics/manifest/application-element.html> >>>>> element's >>>>> permission<http://developer.android.com/guide/topics/manifest/application-element.html#prmsn> >>>>> attribute >>>>> applies to the broadcast receiver. " >>>> >>>> >>>> Now, you didn't provide the Permission attribute of you manifest (nor >>>> the Uses-Permissions), but i'd bet a pretty penny that it has >>>> receive_boot_completed there...since you know.. it doesn't work without it. >>>> >>> >>> This makes sense - so since I ask for receive_boot_completed the system >>> checks my intent filter, sees the intent I filter for is "android.intent. >>> action.BOOT_COMPLETED" and automatically applies this permission to my >>> receiver ? So this receiver _requires permission_ and no warning is issued >>> That is not so straightforward - does it mean that only the system can >>> call my receiver ? >>> >>> >>>> >>>> BTW, some of the questions are just plain annoying which is why i >>>> ignored them and just let you figure it out yourself with the docs... >>>> "Does >>>> it mean that it won't work if exported="false" ?" Why are you asking us? >>>> Instead of posting a question about it, isn't it easier to just do a quick >>>> test instead of relying on the memory of other people? You already have >>>> the code ready.. just run the damn thing and check. >>>> >>> I could test in this case yes - but i wanted a general answer on all >>> similar intent filters and moreover i have no other app to call my receiver >>> from - it's not a quick test >>> >>> >>>> >>>> Also, considering this is only a warning, you're giving it way too much >>>> emphasis. >>>> >>> >>> I disagree - I do pay attention to warnings - I want none :) >>> >>>> >>>> >>>> On Sunday, May 5, 2013 6:29:52 PM UTC+3, Palmer Eldritch wrote: >>>>> >>>>> Did you read the question ? >>>>> >>>>> " >>>>> If Exported=True or Exported is not set and it has an Intent Filter, >>>>> you get a warning saying you didn't specify any permissions for it IF you >>>>> didnt set any permissions for it. >>>>> " >>>>> >>>>> I HAVE an intent filter and I get NO warning - I have posted the >>>>> manifest and specific questions >>>>> Please read before posting - I feel a bit offended being redirected to >>>>> the docs after the effort I put in asking this >>>>> >>>>> On Sunday, May 5, 2013 10:22:07 AM UTC+3, Piren wrote: >>>>>> >>>>>> Did you read the docs? what's not to get here? >>>>>> >>>>>> http://developer.android.com/guide/topics/manifest/receiver-element.html#prmsn >>>>>> >>>>>> If Exported=False or not set and no IntentFilter, only your app can >>>>>> access it so it needs no permissions thus no warning. >>>>>> If Exported=True or Exported is not set and it has an Intent Filter, >>>>>> you get a warning saying you didn't specify any permissions for it IF >>>>>> you >>>>>> didnt set any permissions for it. >>>>>> >>>>>> >>>>>> >>>>>> On Saturday, May 4, 2013 3:47:06 PM UTC+3, Palmer Eldritch wrote: >>>>>>> >>>>>>> Still interested in this >>>>>>> >>>>>>> 1. Why there is no warning : >>>>>>> >>>>>>> <receiver <!-- no warning --> >>>>>>> android:name=".receivers.TriggerMonitoringBootReceiver" >>>>>>> android:enabled="false" > >>>>>>> <intent-filter> >>>>>>> <action >>>>>>> android:name="android.intent.action.BOOT_COMPLETED" /> >>>>>>> </intent-filter> >>>>>>> </receiver> >>>>>>> >>>>>>> Does it mean that it won't work if exported="false" ? In this case : >>>>>>> >>>>>>> 2. Which intents are meant to be exported with no warnings ? All the >>>>>>> intents in android.intent.action. namespace ? >>>>>>> >>>>>>> There are reports that contradict that - adding to general confusion. >>>>>>> See for instance : >>>>>>> >>>>>>> >>>>>>> http://stackoverflow.com/questions/11462936/exported-activity-does-not-require-permission-when-attempting-to-launch-from-a/11526028#comment18783318_11526028 >>>>>>> >>>>>>> http://stackoverflow.com/questions/11875371/what-permission-should-i-use-to-receiver-of-android-notitications#comment15822652_11875525 >>>>>>> >>>>>>> http://stackoverflow.com/questions/13517128/android-onbootreceiver-exported-receiver-does-not-require-permission#comment23027535_13517128 >>>>>>> >>>>>>> http://stackoverflow.com/questions/16112470/android-exported-receiver-does-not-require-permission-on-receivers-meant-to >>>>>>> http://stackoverflow.com/a/12180426/281545 >>>>>>> >>>>>>> http://stackoverflow.com/questions/12718231/making-nfc-activity-private-without-androidexported-false >>>>>>> >>>>>>> http://stackoverflow.com/questions/14381807/how-to-stop-opening-the-application-from-other-application-in-android/14381976#14381976 >>>>>>> >>>>>>> As you see both black and white are true so I would appreciator some >>>>>>> official feedback >>>>>>> In short - when one has receivers that receive System intents like >>>>>>> "android.intent.action.BOOT_COMPLETED" and >>>>>>> "android.net.wifi.SCAN_RESULTS" >>>>>>> - setting the `exported="false"` will prevent the receivers from >>>>>>> working ? >>>>>>> Is this the reason why "Exported receiver does not require permission" >>>>>>> warning is not displayed ? Which intents fall into this category ? >>>>>>> >>>>>>> Thanks :) >>>>>>> >>>>>>> On Saturday, April 20, 2013 3:44:52 PM UTC+3, Palmer Eldritch wrote: >>>>>>>> >>>>>>>> I have the following receivers declared : >>>>>>>> <pre> >>>>>>>> <receiver <!-- no warning --> >>>>>>>> android:name=".receivers.TriggerMonitoringBootReceiver" >>>>>>>> android:enabled="false" > >>>>>>>> <intent-filter> >>>>>>>> <action >>>>>>>> android:name="android.intent.action.BOOT_COMPLETED" /> >>>>>>>> </intent-filter> >>>>>>>> </receiver> >>>>>>>> <receiver <!-- no warning --> >>>>>>>> android:name=".receivers.ScanResultsReceiver" >>>>>>>> android:enabled="false" > >>>>>>>> <intent-filter> >>>>>>>> <action android:name="android.net.wifi.SCAN_RESULTS" /> >>>>>>>> </intent-filter> >>>>>>>> </receiver> >>>>>>>> </pre> >>>>>>>> >>>>>>>> These receivers are exported - right ? If I put `exported="false"` >>>>>>>> would they still be able to work ? >>>>>>>> >>>>>>>> Thanks >>>>>>>> >>>>>>> -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.