<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • android引導用戶開啟自啟動權限的方法-創(chuàng)新互聯

            前言:

            江山ssl適用于網站、小程序/APP、API接口等需要進行數據傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯建站的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

            最近在做項目的過程中遇到了以下一個需求,雖然看起來不難實現,但是在實現的過程中遇到了各種坑,記錄一下,今后方便查看!!!

            需求:

            用戶第一次安裝APP,點擊授權按鈕,跳轉至授權的頁面(不同手機跳轉到不同的授權頁面),用戶授權成功之后,點擊返回按鈕,直接進入主頁面

            問題:

            1.如何適配不同機型

            2.不同機型的授權頁面顯示不同彈窗(比如三星顯示懸浮窗,小米顯示彈窗)

            3.小米彈窗始終無法顯示

            4.在授權頁面點擊返回按鈕,怎么直接跳轉到主頁面

            問題1:適配不同機型

            這個是借鑒的一篇博文(忘記地方了,后邊找到了再添加~~)

            public class MobileInfoUtils{
             private SettingDialogPermision dialog_per;
             //獲取手機類型
             private static String getMobileType() {
              return Build.MANUFACTURER;
             }
            
             //跳轉至授權頁面
             public void jumpStartInterface(Context context) {
              Intent intent = new Intent();
              try {
               intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
               Log.e("HLQ_Struggle", "******************當前手機型號為:" + getMobileType());
               ComponentName componentName = null;
               if (getMobileType().equals("Xiaomi")) { // 紅米Note4測試通過
                componentName = new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity");
            
               } else if (getMobileType().equals("Letv")) { // 樂視2測試通過
                intent.setAction("com.letv.android.permissionautoboot");
               } else if (getMobileType().equals("samsung")) { // 三星Note5測試通過
                //componentName = new ComponentName("com.samsung.android.sm_cn", "com.samsung.android.sm.ui.ram.AutoRunActivity");
                //componentName = ComponentName.unflattenFromString("com.samsung.android.sm/.ui.ram.RamActivity");// Permission Denial not exported from uid 1000,不允許被其他程序調用
                componentName = ComponentName.unflattenFromString("com.samsung.android.sm/.app.dashboard.SmartManagerDashBoardActivity");
               } else if (getMobileType().equals("HUAWEI")) { // 華為測試通過
                //componentName = new ComponentName("com.huawei.systemmanager", "com.huawei.systemmanager.optimize.process.ProtectActivity");//鎖屏清理
                componentName = ComponentName.unflattenFromString("com.huawei.systemmanager/.startupmgr.ui.StartupNormalAppListActivity");//跳自啟動管理
                //SettingOverlayView.show(context);
               } else if (getMobileType().equals("vivo")) { // VIVO測試通過
                componentName = ComponentName.unflattenFromString("com.iqoo.secure/.safeguard.PurviewTabActivity");
               } else if (getMobileType().equals("Meizu")) { //萬惡的魅族
                //componentName = ComponentName.unflattenFromString("com.meizu.safe/.permission.PermissionMainActivity");//跳轉到手機管家
                componentName = ComponentName.unflattenFromString("com.meizu.safe/.permission.SmartBGActivity");//跳轉到后臺管理頁面
               } else if (getMobileType().equals("OPPO")) { // OPPO R8205測試通過
                componentName = ComponentName.unflattenFromString("com.oppo.safe/.permission.startup.StartupAppListActivity");
               } else if (getMobileType().equals("ulong")) { // 360手機 未測試
                componentName = new ComponentName("com.yulong.android.coolsafe", ".ui.activity.autorun.AutoRunListActivity");
               } else {
                // 將用戶引導到系統設置頁面
                if (Build.VERSION.SDK_INT >= 9) {
                 Log.e("HLQ_Struggle", "APPLICATION_DETAILS_SETTINGS");
                 intent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
                 intent.setData(Uri.fromParts("package", context.getPackageName(), null));
                } else if (Build.VERSION.SDK_INT <= 8) {
                 intent.setAction(Intent.ACTION_VIEW);
                 intent.setClassName("com.android.settings", "com.android.settings.InstalledAppDetails");
                 intent.putExtra("com.android.settings.ApplicationPkgName", context.getPackageName());
                }
               }
               intent.setComponent(componentName);
               context.startActivity(intent);
               if (getMobileType().equals("Xiaomi")) {
                showtip();//顯示彈窗(**特別注意**)
               }
               if (getMobileType().equals("samsung")){
                new SettingOverlayView().show(context);//顯示懸浮窗
               }
            
              } catch (Exception e) {//拋出異常就直接打開設置頁面
               Log.e("HLQ_Struggle", e.getLocalizedMessage());
               intent = new Intent(Settings.ACTION_SETTINGS);
               context.startActivity(intent);
              }
             }
            
            //小米手機顯示彈窗
             private void showtip() {
              try {
               dialog_per=new SettingDialogPermision(context, R.style.CustomDialog4);
               dialog_per.getWindow().setType(WindowManager.LayoutParams.TYPE_TOAST);//注意這里改成吐司類型
               dialog_per.show();
               Log.e("HLQ_Struggle","顯示彈窗");
              } catch (Exception e) {
               e.printStackTrace();
               Log.e("HLQ_Struggle", "沒有顯示彈窗"+e.getMessage());
              }
             }
            }

            網頁名稱:android引導用戶開啟自啟動權限的方法-創(chuàng)新互聯
            網站路徑:http://www.jbt999.com/article42/ccphec.html

            成都網站建設公司_創(chuàng)新互聯,為您提供標簽優(yōu)化電子商務面包屑導航企業(yè)網站制作微信小程序靜態(tài)網站

            廣告

            聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯

            微信小程序開發(fā)

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 午夜激情福利 | 黄色逼逼视频 | 亚洲成人免费网 | 免费在线看黄色片视频。 | 九九草色播免费视频观看 |