亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在核心 Java 中識別安卓設備

在核心 Java 中識別安卓設備

慕村225694 2022-09-22 19:29:06
我正在用核心Java做一個項目,它將一些處理過的文件推送到Android設備。所以我需要的是,我只需要識別連接到我的計算機的Android設備,并將一些文件推送到內部存儲。假設設備已連接,并且設備中已授予訪問內部存儲的權限。
查看完整描述

1 回答

?
弒天下

TA貢獻1818條經驗 獲得超8個贊

//**************************

// The UAgentInfo class encapsulates information about

//   a browser's connection to your web site. 

//   The object's detection methods return booleans: true or false.

public class UAgentInfo

{

   //Stores some info about the browser and device.

   private String userAgent;


   //Stores info about what content formats the browser can display.

   private String httpAccept; 


   // A long list of strings which provide clues 

   //   about devices and capabilities.

   public static final String deviceIphone = "iphone";


   // [ SNIP! Other variables snipped out ] 



   //**************************

   //The constructor. Initializes several default variables.

   public UAgentInfo(String userAgent, String httpAccept) {

        if (userAgent != null) {

            this.userAgent = userAgent.toLowerCase();

        }

        if (httpAccept != null) {

            this.httpAccept = httpAccept.toLowerCase();

        }

    }


   //**************************

   //Returns the contents of the User Agent value, in lower case.

   public String getUserAgent()

   { 

       return userAgent;

   }


   //**************************

   // Detects if the current device is an iPhone.

   public boolean detectIphone()

   {

        //The iPod touch says it's an iPhone! So let's disambiguate.

        if (userAgent.indexOf(deviceIphone) != -1 && !detectIpod()) {

            return true;

        }

        return false;

   }


   // [ SNIP! Other functions snipped out ] 


}


查看完整回答
反對 回復 2022-09-22
  • 1 回答
  • 0 關注
  • 80 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號