APISonar


android.content.Context.getBasePackageName

> android > content > Context > getBasePackageName
android APIs content APIs Context APIs getBasePackageName APIs

Example 1
private final Context mContext;

    public boolean hasText() {
        try {
            return getService().hasClipboardText(mContext.getBasePackageName());
        } catch (RemoteException e) {
            return false;
        }
    }
Example 2
private Context mContext;

    public List<ScanResult> getScanResults() {
        try {
            return mService.getScanResults(mContext.getBasePackageName());
        } catch (RemoteException e) {
            return null;
        }
    }
Example 3
private final Context mContext;

    public List<NeighboringCellInfo> getNeighboringCellInfo() {
        try {
            return getITelephony().getNeighboringCellInfo(mContext.getBasePackageName());
        } catch (RemoteException ex) {
            return null;
        } catch (NullPointerException ex) {
            return null;
        }
    }
Example 4
private final Context mContext;

    public void addPrimaryClipChangedListener(OnPrimaryClipChangedListener what) {
        synchronized (mPrimaryClipChangedListeners) {
            if (mPrimaryClipChangedListeners.size() == 0) {
                try {
                    getService().addPrimaryClipChangedListener(
                            mPrimaryClipChangedServiceListener, mContext.getBasePackageName());
                } catch (RemoteException e) {
                }
            }
            mPrimaryClipChangedListeners.add(what);
        }
    }
Example 5
private final Context mContext;

    public void setPrimaryClip(ClipData clip) {
        try {
            if (clip != null) {
                clip.prepareToLeaveProcess();
            }
            getService().setPrimaryClip(clip, mContext.getBasePackageName());
        } catch (RemoteException e) {
        }
    }
Example 6
final Context mContext;

    public WakeLock newWakeLock(int levelAndFlags, String tag) {
        validateWakeLockParameters(levelAndFlags, tag);
        return new WakeLock(levelAndFlags, tag, mContext.getBasePackageName());
    }
Example 7
public SystemVibrator(Context context) {
        mPackageName = context.getBasePackageName();
        mService = IVibratorService.Stub.asInterface(
                ServiceManager.getService("vibrator"));
    }
Example 8
private final Context mContext;

    public void adjustMasterVolume(int steps, int flags) {
        IAudioService service = getService();
        try {
            service.adjustMasterVolume(steps, flags, mContext.getBasePackageName());
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in adjustMasterVolume", e);
        }
    }
Example 9
private final Context mContext;

    public void adjustLocalOrRemoteStreamVolume(int streamType, int direction) {
        if (streamType != STREAM_MUSIC) {
            Log.w(TAG, "adjustLocalOrRemoteStreamVolume() doesn't support stream " + streamType);
        }
        IAudioService service = getService();
        try {
            service.adjustLocalOrRemoteStreamVolume(streamType, direction,
                    mContext.getBasePackageName());
        } catch (RemoteException e) {
            Log.e(TAG, "Dead object in adjustLocalOrRemoteStreamVolume", e);
        }
    }
Example 10
private final Context mContext;

    public void requestAudioFocusForCall(int streamType, int durationHint) {
        IAudioService service = getService();
        try {
            service.requestAudioFocus(streamType, durationHint, mICallBack, null,
                    AudioService.IN_VOICE_COMM_FOCUS_ID,
                    mContext.getBasePackageName());
        } catch (RemoteException e) {
            Log.e(TAG, "Can't call requestAudioFocusForCall() on AudioService due to "+e);
        }
    }
Example 11
protected Context mContext;

    public void createSession() {
        if (mSession != null) {
            mSession.release();
        }
        MediaSessionManager man = (MediaSessionManager) mContext
                .getSystemService(Context.MEDIA_SESSION_SERVICE);
        Log.d(TAG, "Creating session for package " + mContext.getBasePackageName());
        mSession = man.createSession("OneMedia");
        mSession.addCallback(mCallback);
        mSession.addTransportControlsCallback(new TransportCallback());
        mSession.setPlaybackState(mPlaybackState);
        mSession.setFlags(MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
        mSession.setRouteOptions(mRouteOptions);
        mSession.setActive(true);
    }