public override void OnCreate()
        {
            Logger.d(TAG, "[ExampleApplication] onCreate");
            base.OnCreate();

            JPushInterface.SetDebugMode(true); // 设置开启日志,发布时请关闭日志
            JPushInterface.Init(this);         // 初始化 JPush
        }
        /// <summary>
        /// init JPush
        /// </summary>
        private void InitJPush()
        {
            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(Application.Context);
            BasicPushNotificationBuilder builder = new BasicPushNotificationBuilder(this);

            builder.StatusBarDrawable = Resource.Drawable.jpush_notification_icon;
            JPushInterface.SetPushNotificationBuilder(new Java.Lang.Integer(1), builder);
        }
Exemple #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(this);
            _common = new CommonFun_Droid();
            CopyLocalDB();
            //ToolbarResource = Resource.Layout.toolbar_layout;

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
            {
                Android.Webkit.WebView.SetWebContentsDebuggingEnabled(true);
            }

            if (!Resolver.IsSet)
            {
                this.SetIoc();
            }
            //else
            //{
            //    var app = Resolver.Resolve<IXFormsApp>() as IXFormsApp<XFormsApplicationDroid>;
            //    if (app != null) app.AppContext = this;
            //}

            global::Xamarin.Forms.Forms.Init(this, bundle);

            commonhelper = Resolver.Resolve <CommonHelper>();
            if (commonhelper.IsNetWorkConnected())
            {
                //PgySdk
                PgyCrashManager.Register(this);
            }
            UserDialogs.Init(this);
            CachedImageRenderer.Init();
            SecureStorageImplementation.StoragePassword = "******";
            RegistUpdate();

            Xamarin.Forms.Forms.ViewInitialized += (sender, e) =>
            {
                if (!string.IsNullOrWhiteSpace(e.View.StyleId))
                {
                    e.NativeView.ContentDescription = e.View.StyleId;
                }
            };
            LoadApplication(new App());
            BackPressed += MainActivity_BackPressed;

            string regID = JPushInterface.GetRegistrationID(ApplicationContext);

            App.ScreenWidth  = (int)(Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density);
            App.ScreenHeight = (int)(Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density);
        }
Exemple #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            FormsAppCompatActivity.ToolbarResource   = Resource.Layout.toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;

            LoadApplication(new App(IoC.Get <SimpleContainer>()));

            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(this);
        }
Exemple #5
0
        private void initPushNotification()
        {
            IntentFilter filter = new IntentFilter();

            filter.AddAction(JPushInterface.ActionNotificationOpened);
            filter.AddAction(JPushInterface.ActionNotificationReceived);
            filter.AddAction(JPushInterface.ActionMessageReceived);
            filter.AddAction(JPushInterface.ActionRegistrationId);
            filter.AddAction(JPushInterface.ActionConnectionChange);
            NotificationReceiver receiver = new NotificationReceiver();

            RegisterReceiver(receiver, filter);
            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(this.ApplicationContext);
        }
Exemple #6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            //global::Xamarin.Forms.Forms.Init(this, bundle);

            //LoadApplication(new App(IoC.Get<SimpleContainer>()));

            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(ApplicationContext);

            appContext = ApplicationContext;

            //MyTags.Add("123");
            new JPushInterface().SetAliasAndTags(appContext, myAlias, MyTags);
            // Set our view from the "main" layout resource
            //SetContentView (Resource.Layout.Main);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            FFImageLoading.Forms.Droid.CachedImageRenderer.Init();

            global::Xamarin.Forms.Forms.Init(this, bundle);

            FormsAppCompatActivity.ToolbarResource   = Resource.Layout.toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;

            // https://github.com/Caliburn-Micro/Caliburn.Micro/issues/298
            //this.LoadApplication(new App(IoC.Get<SimpleContainer>()));
            this.LoadApplication(IoC.Get <App>());

            //TODO 调试模式, 发布时请改为 false
            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(this);
        }
        public override void OnCreate()
        {
            base.OnCreate();
            #region 极光推送相关
            //注册Jpush
            JPushInterface.SetDebugMode(true);
            JPushInterface.Init(ApplicationContext);
            //设置基本样式
            SetNotificationStyleBasic();
            //自定义推送通知栏样式 test
            SetNotificationStyleCustom();
            //设置保留最近5条通知
            JPushInterface.SetLatestNotificationNumber(ApplicationContext, 5);
            #endregion

            #region imageloader 使用二级缓存
            //var configuration = ImageLoaderConfiguration.CreateDefault(ApplicationContext);//创建默认的ImageLoader配置参数

            //自定义缓存路径
            var          cachePath = Android.OS.Environment.ExternalStorageDirectory.ToString() + "/" + "eldyoungCommCenter/Cache/HeadImage/";
            Java.IO.File file      = new Java.IO.File(cachePath);
            if (!file.Exists())
            {
                file.Mkdirs();                                                                     // 创建文件夹
            }
            File cacheDir      = StorageUtils.GetOwnCacheDirectory(ApplicationContext, cachePath); //自定义缓存路径
            var  configuration = new ImageLoaderConfiguration.Builder(ApplicationContext).MemoryCacheExtraOptions(480, 800)
                                 .ThreadPoolSize(3).ThreadPriority(Thread.NormPriority - 2).DenyCacheImageMultipleSizesInMemory()
                                 .MemoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)).MemoryCacheSize(2 * 1024 * 1024).DiskCacheSize(50 * 1024 * 1024)
                                 .DiskCacheFileNameGenerator(new Md5FileNameGenerator()).TasksProcessingOrder(QueueProcessingType.Lifo).DiskCacheFileCount(100)
                                 .DiskCache(new UnlimitedDiskCache(cacheDir)).DefaultDisplayImageOptions(DisplayImageOptions.CreateSimple()).ImageDownloader(new BaseImageDownloader(ApplicationContext, 5 * 1000, 30 * 1000))
                                 .Build();
            ImageLoader.Instance.Init(configuration);

            #endregion

            #region 百度地图使用
            SDKInitializer.Initialize(ApplicationContext);
            #endregion
        }
Exemple #9
0
 public void Init(bool debugMode)
 {
     JPushInterface.SetDebugMode(debugMode);
     JPushInterface.Init(Android.App.Application.Context);
 }