ContextWrapper getSystemService - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ContextWrapper getSystemService method.

This code example shows how to use the following methods:getSystemService, getClass
This code example shows how to use the following methods:getSystemService
      @Override public void run() { 
        Application app = (Application) getTargetContext().getApplicationContext();
        String simpleName = SpoonInstrumentationTestRunner.class.getSimpleName();
 
        // Unlock the device so that the tests can input keystrokes. 
        ((KeyguardManager) app.getSystemService(KEYGUARD_SERVICE)) //
            .newKeyguardLock(simpleName) //
            .disableKeyguard();
        // Wake up the screen. 
        ((PowerManager) app.getSystemService(POWER_SERVICE)) //
            .newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP | ON_AFTER_RELEASE, simpleName) //
            .acquire();
      } 
    }); 
 
    super.onStart(); 
  } 
} 
7
CodeRank
This code example shows how to use the following methods:getSystemService, getClass
        mSetForegroundArgs[0] = Boolean.FALSE;
        invokeMethod(mSetForeground, mSetForegroundArgs);
    } 
 
    public void init() { 
        mNM = (NotificationManager) mService.getSystemService(Service.NOTIFICATION_SERVICE);
        try { 
            mStartForeground = mService.getClass().getMethod("startForeground",
                    mStartForegroundSignature);
            mStopForeground = mService.getClass().getMethod("stopForeground",
                    mStopForegroundSignature);
            return; 
        } catch (NoSuchMethodException e) {
            // Running on an older platform. 
            mStartForeground = mStopForeground = null;
        } 
        try { 
            mSetForeground = mService.getClass()
                    .getMethod("setForeground", mSetForegroundSignature);
        } catch (NoSuchMethodException e) {

7
CodeRank
This code example shows how to use the following methods:getSystemService, getClass
This code example shows how to use the following methods:getSystemService, registerReceiver
 
            // Keep reference to app 
            this.app = app;
 
            // Registering receiver to handle network changes 
            app.registerReceiver(this, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
 
            // Getting connectivity manager and current network type 
            conMgr = (ConnectivityManager) app.getSystemService(Context.CONNECTIVITY_SERVICE);
            if (conMgr != null) {
                final NetworkInfo netInfo = conMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
                if (netInfo != null) {
                    currentNetworkSubType = netInfo.getSubtype();
                } 
            } 
        } 
    } 
 
    /** 
     * Build the AndroidHttpClient. 
6
CodeRank
This code example shows how to use the following methods:getSystemService, getCurrentInputConnection
		return inputMethodService.getCurrentInputEditorInfo();
	} 
 
	@Nonnull 
	private InputConnection getCurrentInputConnection() {
		InputConnection result = this.inputMethodService.getCurrentInputConnection();
		if (result == null) {
			result = NoInputConnection.getInstance();
		} 
		return result;
	} 
 
	@Override 
	public CharSequence getTypedText() {
		return typedText;
	} 
 
	@Override 
	public void clearTypedText() { 
		this.typedText.setLength(0);

6
CodeRank
This code example shows how to use the following methods:getSystemService
	 * init 
	 * @param service 
	 */ 
	public static void init(Service service){
		mService = service;
	   	mLocationManager = (LocationManager)service.getSystemService(Context.LOCATION_SERVICE);
	   	loadWazeConfig(); 
	} 
	 
	/************************************************************************************************* 
	 * loadWazeConfig 
	 *  
	 */ 
	public static void loadWazeConfig(){ 
		WazeAppWidgetLog.d("loadWazeConfig" ); 
    	WazePreferences.load(); 
    	WazeUserPreferences.load(); 
    	WazeHistory.load(); 
    	WazeLang.load(WazeUserPreferences.getProperty("System.Language")); 
	} 
5
CodeRank
This code example shows how to use the following methods:getSystemService, getClass
This code example shows how to use the following methods:getSystemService
This code example shows how to use the following methods:getSystemService
 
	private Connector<HS, C> connector;
	private EventHandler<HS, C> eventHandler;
 
	public HermesApplicationWrapper(Application application, Class<HS> hermeServiceClass) {
		connector = new Connector<HS, C>(application, hermeServiceClass );		
		ServiceHandler<HS, C> serviceHandler = new ServiceHandler<HS, C>(application, hermeServiceClass, (ActivityManager) application.getSystemService(Context.ACTIVITY_SERVICE));		
		eventHandler = new EventHandler<HS, C>(this.connector, serviceHandler);	
	} 
	 
	@Override 
	public Connector<HS, C> getConnector() { 
		return connector;
	} 
 
	@Override 
	public EventHandler<HS, C> getEventHandler() { 
		return eventHandler;
	} 
} 
5
CodeRank

Related ContextWrapper getSystemService Questions & Answers:

getSystemService Method Overview
Return the handle to a system-level service by name.
See Code Examples for other Android ContextWrapper Methods: