0 Replies - 460 Views - Last Post: 16 August 2017 - 05:34 AM

#1 Alhazred  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 195
  • Joined: 25-July 07

How to register a BroadcastReceiver for all the activities?

Posted 16 August 2017 - 05:34 AM

I'm developing an app with several activities.
In each activity it is required that an internet connection is available, if not, I show a TextView which notifies the missing connection.

To check the changes of the connection status I wanted to register a BroadcastReceiver within the AndroidManifest.xml file, but reading the documentation since API Level 24 the CONNECTIVITY_ACTION is not broadcasted to the receivers registered within the xml file, while it is still broadcasted to those registered inside the activities using Context.registerReceiver().

This should mean that I have to register the receiver in each activity, is this correct?
Is there another way to register the receiver globally for the app?

This post has been edited by Alhazred: 16 August 2017 - 05:34 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1