App Inventor:Androidアプリの作成-チュートリアル
この実用的なヒントでは、App Inventorを使用してAndroidアプリを作成する方法を説明します。 比較的短時間でアプリを構築するには、このチュートリアルに従ってください。
MIT App Inventorにサインインする
App Inventor Webサイトにアクセスし、右上隅の[作成]ボタンをクリックします。
- App Inventorには、Googleアカウントへのアクセス許可が必要です。 「許可」をクリックして確認します。
- 最初のログイン後、調査に参加できます。 これを望まない場合は、「調査を行わない」をクリックしてください。
- 次に、[続行]をクリックしてApp Inventorワークスペースを開きます。
App Inventorで最初のアプリを作成する-レイアウト
- 左上隅の[新しいプロジェクト]ボタンをクリックします。 プロジェクト名を入力し、「OK」を選択します。
- 次に、左側の「ユーザーインターフェース」から「ラベル」を中央の画面にドラッグします。 [プロパティ]で、新しく追加されたマーク付きラベルの[テキスト]を変更できます。
- 「プロジェクト」でプロジェクトを保存し、「プロジェクトを保存」を選択します。
- これで、他のすべてのUI要素を画面にスライドできます。 他のメディアコンテンツも「Drawing and Animation」で追加できます。
- 「レイアウト」を使用して、要素の配置を変更します。
ブロック上のロジック-例
アプリ用に追加の画面を作成する場合は、[画面の追加]をクリックします。 その後、たとえばUI要素「ボタン」を使用して、レイアウトの2番目の画面に移動できます。 ただし、これを行うには、バックグラウンドで実行するロジックが必要です。 App Inventorでは、「ブロック」を使用してそれらを構築します。
- これを行うには、右上隅の[デザイナー]の横にある[ブロック]をクリックします。 そこで、対応する画面に移動し、左側の「ブロック」ディスプレイのボタンをクリックします。
- 「when Button1.Click do」機能を選択します。
- ここで、「Control」要素をこの「Puzzle」要素、つまり「open another screen screenName」に挿入します。
- これで、スクリーン名のみが欠落しています。 これを行うには、ブロック表示で「テキスト」をクリックし、2つの引用符のみで構成される上部要素を選択します。
- このテキスト要素に画面の名前、この例では「Screen2」を入力します。
スマートフォンでアプリをテストする
App Inventorで作成したアプリをAndroidスマートフォンで直接テストする場合は、以下の手順に従ってください。
- MIT App Inventor Companion AppをAndroidスマートフォンにインストールします。
- コンピューターとAndroidスマートフォンが同じWiFiネットワーク上にあることを確認してください。
- スマートフォンでアプリを開き、PCのトップメニューバーで[接続]をクリックし、[AIコンパニオン]を選択します。
- スマートフォンのアプリで「QRコードをスキャン」をタップし、PCに表示されたQRコードをスキャンします。 または、アプリのテキストフィールドに表示される6桁のコードを入力し、[コードで接続]ボタンをタップします。
- これで、Smarpthoneでアプリを試すことができます。
エミュレーターでアプリをテストする
スマートフォンを使用できない場合は、App Inventorに統合されたエミュレーターでアプリをテストします。
- App Inventorソフトウェアをダウンロードしてインストールします。
- インストールされたアプリケーションを開きます。 PCで携帯電話の画面が開きます。
- ここで、開いているプロジェクトの下にあるApp-Inventorのメニューバーの[接続]をクリックし、そこで[エミュレータ]を選択します。 以前にスマートフォンに接続したことがある場合は、「接続のリセット」をタップする必要があります。
- これで、アプリケーションがエミュレーターに表示されます。
- 場合によっては、エラーメッセージが表示されます。 したがって、コンパニオンアプリは最新ではありません。 次に、表示されるウィンドウで[OK]をクリックします。
- 「OK」および「インストール」を使用して、エミュレータで更新を確認します。 最後に、エミュレータ画面で「完了」をクリックします。
- [接続]-> [接続のリセット]、[接続]-> [エミュレータ]の順に接続します。
アプリを作成したら、[ビルド]を使用して、メニューバーのコンピューターにアプリの.apkファイルを保存できます。 Google Playでアプリを公開したら、アプリのマーケティングについても検討する必要があります。