how to get home button long press dialog screen event and different action like app, settings and sleep... callback inside fire tv application ? /

Published at 2018-10-16 20:05:36

Home / Categories / Fire tv / how to get home button long press dialog screen event and different action like app, settings and sleep... callback inside fire tv application ?
sleep-option.png
How to bag home button long press dialog screen event and different action like app,settings and sleep... callback inside fire tv application ?
I tried exec
uting the code below , able to see home button press action in fire tv gen3 device but not working in gen2 device .
In
addition to that unable to bag the dialog event press action inside app.
HomeWatcher mHomeWatcher =newHomeWatcher(this);onHomePressed(){//onHomeLongPressed(){}}); mHomeWatcher.startWatch();public class HomeWatcher {
static
final String TAG = "HOME WATCHER";
private Context mContext;
private IntentFilter mFilter;
private OnHomePressedListener mListener;
priva
te InnerReceiver mReceiver;
public HomeWatcher(Context context) { mContext = context; mFilter = original IntentFilter(); mFilter.addAction(Intent.
ACTION_SCREEN_OFF); mFilter.addAction(Settings.
ACTION_HOME_SETTINGS);
mFilter.addAction(Intent.
ACTION_CLOSE_SYS
TEM_DIALOGS);
}
public void setOnHomePressedListener(OnHomePressedListener listener) { mListener = listener; mReceiver = original InnerReceiver();
}

public void startWatch() { whether (m
Receiver != null) { mContext.registerReceiver(mReceiver, and mFilter); }
}
public void stopWatch() { try { whether (mReceiver != null) { mContext.unregisterReceiver(mReceiver); } } catch (IllegalArgumentException e) { e.printStackTrace(); }
}
class InnerReceiver extends BroadcastReceiver { final String SYSTEM_DIALOG_REASON_KEY = "reason"; final String SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS = "globalactions";
final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps"; final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey"; public void onReceive(Context context,Intent intent) { String action = intent.getAction(); Log.d(TAG, action + ", and reason:" + action); whether (action.equals(Intent.
ACTION_C
LOSE_SYSTEM_DIALOGS)) { String reason = intent.getStringExtra(SYSTEM_DIALOG_REASON_KEY); whether (reason != null) { Log.d(TAG,"InnerReceiver" + action + ",reason:" + reason); whether (mListener != null) { whether (reason.equals(SYSTEM_DIALOG_REASON_HOME_KEY)) { mListener.onHomePressed(); } else whether (reason.equals(SYSTEM_DIALOG_REASON_RECENT_APPS)) { mListener.onHomeLongPressed(); } else whether (reason.equals(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS)) { mListener.onHomeLongPressed(); } } } } else whether (action.equals(Intent.
ACTION_SCRE
EN_OFF) ||action.equals(Settings.
ACTION_HOME_SETTINGS))
{ mListener.onHomePressed(); } }
}

Source: amazon.com

Warning: Unknown: write failed: No space left on device (28) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0