How to initialize MvvmCross structure without burst activity?

In my application, I create a broadcast receiver that will listen for network changes. In OnReceive, it will check if the device is only connected to WiFi, and then start downloading in the background. No action will be shown, so what do I need to do to initialize the frame without a burst of activity? I don’t need any part of the navigation on the frame pages, so optimal initialization would be optimal.

    private override void OnReceive(Context context, Intent intent)
    {
        bool isWifiConnected = false;
        bool isMobileConnected = false;

        if (intent.Action.Equals(ConnectivityManager.ConnectivityAction))
        {
            NetworkInfo networkInfo = (NetworkInfo)intent.GetParcelableExtra(ConnectivityManager.ExtraNetworkInfo);


            if (networkInfo.IsConnected)
            {
                if (networkInfo.Type == (int)ConnectivityType.Wifi)
                {
                    isWifiConnected = true;
                }
                if (networkInfo.Type == (int)ConnectivityType.Mobile)
                {
                    isMobileConnected = true;
                }
            }
        }

        if (isWifiConnected)
        {
            StartUp(); //What do I put in this private method?
        }
+3
source share
2 answers

Now I have added some changes to GitHub that hopefully allow you to create an application using BroadcastReceiver.

, - Activity, BroadcastReceiver, Service ContentProvider - :

var setup = MvxAndroidSetupSingleton.GetOrCreateSetup(this.ApplicationContext);
setup.EnsureInitialized(this.GetType());

MvvmCross "Intent.ActionMain", :

  • Service, BroadcastReceiver ContentProvider.
  • , Android , ( WP7).

http://slodge.blogspot.co.uk/2012/05/android-application-initialization-and.html

+5

, . ( ) ...


, , , , MVVM?

, "raw MonoDroid"? , Android?

? - . IoC? , MVvvm - , ?


, , SimpleBinding - https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20SimpleDialogBinding/SimpleBinding/SimpleDroid

"" MvxSimpleAndroidBindingSetup, "" - , ?

, , - , , - View ViewModel, , . , .


Android.App.Application MonoDroid - http://developer.android.com/reference/android/app/Application.html

Android OnCreate - , - SplashActivity - , .

, Setup.cs MvxApplication, splashscreen - MvxBaseSplashScreenActivity.cs. , - - :

  • Initialize
  • IMvxStartNavigation.Start(), " "
  • , "" .
  • - . , " "?

Android, , mvx, , - .


, https://github.com/slodge/MvvmCross/issues/new - , ...

+1

All Articles