HOME技術AndroidAndroidアプリ:android:fullBackupContentの宣言

Androidアプリ:android:fullBackupContentの宣言

Android Studioで、以下のようなエラーメッセージが表示されました。

On SDK version 23 and up, your app data will be automatically backed up and restored on app install.
Consider adding the attribute android:fullBackupContent to specify an @xml resource which configures which files to backup, or just set android:fullBackupOnly=true.

SDK23(Android6.0)以降になると、自動的にアプリデータのバックアップをする機能が追加されており、対応するために、android:fullBackupContent属性を追加してほしい、という内容です。

バックアップされるデータは、アプリ内のユーザデータで、ユーザのGoogleドライブに25MBを上限に保存するというもののようです(このデータ容量はGoogleドライブの個人の使用量にはカウントされないそうです)。

バックアップをしない

AndroidManifest.xmlのapplicationにandroid:fullBackupContent=”@xml/backup_rules”を追加すると、さらにそのバックアップルールの定義ファイル(res/xml/backup_rules.xml)の設定などが必要になるため、ここではバックアップをしない設定にします。

バックアップをしない場合には、android:allowBackup=”false”にすればよく、警告も出なくなります。

<application
    android:allowBackup="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:hardwareAccelerated="false"
    android:largeHeap="true"
    tools:ignore="LockedOrientationActivity"
    >

関連記事

Androidアプリ:数値型のViewの値がNullか0以下かを判定する

Android Studioで数値型のEditTextのViewを配置して、値を取得した場合に、その値がNull値(空)もしくは0以下であるか否かを判定する方法です。 Null判定にlength()を…続きを読む

Androidアプリ:AndroidXに対応する

2018年に、AndroidのSupportLibraryは、AndroidXに移行することが発表されました。 AndroidXとは Support Libraryとは簡単に言うと、Androidアプ…続きを読む

Androidアプリ:アプリを更新する場合の設定

一度リリースしたAndroidアプリを更新してアップロードする場合には、必ずバージョンを更新しなければなりません。 今回はバージョンの更新方法について調べました。 build.gradleの修正 bu…続きを読む

Androidアプリ:フォーカスをあてたEditTextのテキストを全選択する

Android StudioでEditTextにフォーカスが当たったと同時に、既に入力されている文字列をすべて選択した状態にする方法です。 EditTextタグに以下のコードを追加 android:s…続きを読む

Androidアプリ:入力された数値を足して表示する

2つのテキストボックスに入力した数値を受け取り、それぞれを足した結果を表示するアプリをつくります。 ここではレイアウト定義ファイルを「activity_main.xml」、 プログラムファイルを「Ma…続きを読む

Androidアプリ:When using intent filters, please specify ‘android:exported’ as well

Android Studioで「When using intent filters, please specify ‘android:exported’ as well」という…続きを読む

Androidアプリを実機で確認する

AndroidアプリをAndroid Studioで開発した際に、実際のスマホの画面で動作確認する方法です。 スマホの設定 以下はArrows FX F-02Hの設定方法です(開発者向けオプションを表…続きを読む

Androidアプリ:ボタンの表示/非表示

Androidでボタンの表示/非表示をプログラム上からコントロールします。 MainActivity.java   Button button = findViewById(R.id.but…続きを読む

Androidアプリ:ボタンを押すとメッセージが入れ替わる

Android StudioでAndroidアプリを試作します。 今回は「ボタンを1回押すとテキストの内容が変わり、もう1回押すと元に戻る」というだけのアプリをつくります。 プロジェクトの生成 And…続きを読む

Androidアプリ:App is not indexable by Google Search;と表示される

Android Studioで、 App is not indexable by Google Search; consider adding at least one Activity with a…続きを読む