mono.android.Runtime Java Examples

The following examples show how to use mono.android.Runtime. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MonoPackageManager.java    From Xamarin-Forms-Shape with MIT License 5 votes vote down vote up
public static void LoadApplication (Context context, String runtimeDataDir, String[] apks)
{
	synchronized (lock) {
		if (!initialized) {
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = context.getApplicationInfo ().dataDir + "/lib";
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					runtimeDataDir,
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			initialized = true;
		}
	}
}
 
Example #2
Source File: MonoPackageManager.java    From Xamarin-Forms-SegmentedControl with MIT License 5 votes vote down vote up
public static void LoadApplication (Context context, String runtimeDataDir, String[] apks)
{
	synchronized (lock) {
		if (!initialized) {
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = context.getApplicationInfo ().dataDir + "/lib";
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					runtimeDataDir,
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			initialized = true;
		}
	}
}
 
Example #3
Source File: MonoPackageManager.java    From ListViewWithSubListView with MIT License 4 votes vote down vote up
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
	synchronized (lock) {
		if (context instanceof android.app.Application) {
			Context = context;
		}
		if (!initialized) {
			android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
					android.content.Intent.ACTION_TIMEZONE_CHANGED
			);
			context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);
			
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = getNativeLibraryPath (context);
			ClassLoader loader  = context.getClassLoader ();
			java.io.File external0 = android.os.Environment.getExternalStorageDirectory ();
			String externalDir = new java.io.File (
						external0,
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath ();
			String externalLegacyDir = new java.io.File (
						external0,
						"../legacy/Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath ();

			Runtime.init (
					language,
					apks,
					getNativeLibraryPath (runtimePackage),
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new String[] {
						externalDir,
						externalLegacyDir
					},
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			
			mono.android.app.ApplicationRegistration.registerApplications ();
			
			initialized = true;
		}
	}
}
 
Example #4
Source File: MonoPackageManager.java    From PS4_Tools with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
	synchronized (lock) {
		if (context instanceof android.app.Application) {
			Context = context;
		}
		if (!initialized) {
			android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
					android.content.Intent.ACTION_TIMEZONE_CHANGED
			);
			context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);
			
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = getNativeLibraryPath (context);
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					getNativeLibraryPath (runtimePackage),
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			
			mono.android.app.ApplicationRegistration.registerApplications ();
			
			initialized = true;
		}
	}
}
 
Example #5
Source File: MonoPackageManager.java    From Xamarin.Forms-Succinctly with Apache License 2.0 4 votes vote down vote up
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
	synchronized (lock) {
		if (context instanceof android.app.Application) {
			Context = context;
		}
		if (!initialized) {
			android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
					android.content.Intent.ACTION_TIMEZONE_CHANGED
			);
			context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);
			
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = getNativeLibraryPath (context);
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					getNativeLibraryPath (runtimePackage),
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			
			mono.android.app.ApplicationRegistration.registerApplications ();
			
			initialized = true;
		}
	}
}
 
Example #6
Source File: MonoPackageManager.java    From Xamarin.Forms-Succinctly with Apache License 2.0 4 votes vote down vote up
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
	synchronized (lock) {
		if (context instanceof android.app.Application) {
			Context = context;
		}
		if (!initialized) {
			android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
					android.content.Intent.ACTION_TIMEZONE_CHANGED
			);
			context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);
			
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = getNativeLibraryPath (context);
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					getNativeLibraryPath (runtimePackage),
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			
			mono.android.app.ApplicationRegistration.registerApplications ();
			
			initialized = true;
		}
	}
}
 
Example #7
Source File: MonoPackageManager.java    From Argus-RAT with GNU General Public License v3.0 4 votes vote down vote up
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
	synchronized (lock) {
		if (context instanceof android.app.Application) {
			Context = context;
		}
		if (!initialized) {
			android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
					android.content.Intent.ACTION_TIMEZONE_CHANGED
			);
			context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);
			
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = getNativeLibraryPath (context);
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					getNativeLibraryPath (runtimePackage),
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			
			mono.android.app.ApplicationRegistration.registerApplications ();
			
			initialized = true;
		}
	}
}
 
Example #8
Source File: MonoPackageManager.java    From Argus-RAT with GNU General Public License v3.0 4 votes vote down vote up
public static void LoadApplication (Context context, ApplicationInfo runtimePackage, String[] apks)
{
	synchronized (lock) {
		if (context instanceof android.app.Application) {
			Context = context;
		}
		if (!initialized) {
			android.content.IntentFilter timezoneChangedFilter  = new android.content.IntentFilter (
					android.content.Intent.ACTION_TIMEZONE_CHANGED
			);
			context.registerReceiver (new mono.android.app.NotifyTimeZoneChanges (), timezoneChangedFilter);
			
			System.loadLibrary("monodroid");
			Locale locale       = Locale.getDefault ();
			String language     = locale.getLanguage () + "-" + locale.getCountry ();
			String filesDir     = context.getFilesDir ().getAbsolutePath ();
			String cacheDir     = context.getCacheDir ().getAbsolutePath ();
			String dataDir      = getNativeLibraryPath (context);
			ClassLoader loader  = context.getClassLoader ();

			Runtime.init (
					language,
					apks,
					getNativeLibraryPath (runtimePackage),
					new String[]{
						filesDir,
						cacheDir,
						dataDir,
					},
					loader,
					new java.io.File (
						android.os.Environment.getExternalStorageDirectory (),
						"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
					MonoPackageManager_Resources.Assemblies,
					context.getPackageName ());
			
			mono.android.app.ApplicationRegistration.registerApplications ();
			
			initialized = true;
		}
	}
}