Code example for IntentFilter

Methods: addAction

0
    public static GeckoBatteryManager getInstance() { 
        return sInstance;
    } 
 
    private GeckoBatteryManager() { 
        mFilter = new IntentFilter();
        mFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
    } 
 
    public void init(Context context) {
        mApplicationContext = context.getApplicationContext();
    } 
 
    public synchronized void start() { 
        if (!mIsEnabled) {
            // registerReceiver will return null if registering fails 
            if (mApplicationContext.registerReceiver(this, mFilter) == null) {
                Log.e(LOGTAG, "Registering receiver failed");
            } else { 
                mIsEnabled = true;
Experience pair programming with AI  Get Codota for Java