以编程方式检查android:allowBackup值

时间:2017-05-27 08:36:33

标签: java android android-manifest android-security android-backup-service

我已经研究过Android中的安全问题,一个好的做法是检查Public Sub Program() Dim i As Long Dim j As Long Dim k As Long i = 2 j = 2 k = 2 Do While Worksheets("Sheet1").Cells(i, "A").Value <> "" 'data from sheet1 Worksheets("Result").Cells(k, "A").Value = Worksheets("Sheet1").Cells(i, "A").Value Worksheets("Result").Cells(k, "B").Value = Worksheets("Sheet1").Cells(i, "B").Value Worksheets("Result").Cells(k, "C").Value = Worksheets("Sheet1").Cells(i, "C").Value Worksheets("Result").Cells(k, "D").Value = Worksheets("Sheet1").Cells(i, "D").Value k = k + 1 Do While Worksheets("Sheet1").Cells(i, "A").Value = Worksheets("Sheet2").Cells(j, "A").Value 'data from sheet1 Worksheets("Result").Cells(k, "A").Value = Worksheets("Sheet2").Cells(j, "A").Value Worksheets("Result").Cells(k, "B").Value = Worksheets("Sheet2").Cells(j, "B").Value Worksheets("Result").Cells(k, "C").Value = Worksheets("Sheet2").Cells(j, "C").Value Worksheets("Result").Cells(k, "D").Value = Worksheets("Sheet2").Cells(j, "D").Value k = k + 1 j = j + 1 Loop k = k + 1 i = i + 1 Loop End Sub 中是否设置了allowBackupbackupAgent

如何以编程方式检查应用的AndroidManifest.xml值?

3 个答案:

答案 0 :(得分:3)



      PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
      if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_ALLOW_BACKUP) != 0) {
         // enabled
      } else {
         // disabled
      }


答案 1 :(得分:1)

查看ApplicationInfo中的FLAG_ALLOW_BACKUP和其他相关标记。

答案 2 :(得分:0)

您也可以使用以下代码进行检查:

hadoop jar %HADOOP_PREFIX%\share\hadoop\tools\lib\hadoop-streaming-2.6.0.jar -mapper mapper.php -reducer reducer.php -input /user/Ahmed/input