Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9a9551c
Merge pull request #1 from ncmbadmin/master
Feb 2, 2017
17d7aff
change_Nifty_text
vfa-tamhh Aug 20, 2018
d9262f6
change domain URL
vfa-tamhh Aug 20, 2018
ff96027
update images
vfa-tamhh Aug 29, 2018
24bc592
update image
vfa-tamhh Aug 30, 2018
1c9c58b
update code
vfa-tamhh Sep 6, 2018
b82413d
deleted
vfa-tamhh Sep 6, 2018
ee6463b
update readme and modified image
vfa-tamhh Sep 11, 2018
2856974
change text and logo in index.html
vfa-tamhh Sep 13, 2018
713f31e
update readme and add image
vfa-tamhh Oct 1, 2018
0360709
upgrade ncmb android sdk version and upgrade gradle
vfa-tamhh Jun 20, 2019
3386c68
Update environment information
Nov 6, 2019
c8ad21c
fix auto open system browser on android 11
vfa-cancc Mar 17, 2020
51e6302
Update readme
Mar 31, 2020
697bdf7
Update image
May 14, 2020
d77be6f
Merge pull request #3 from vfa-tamhh/upgrade_ncmbsdk_android_studio
kobo0908 May 14, 2020
4955ccb
change gradle build tools to 4.0.0
vfa-cancc Jul 22, 2020
2968a08
Merge pull request #6 from vfa-cancc/master
kobo0908 Dec 2, 2020
355acfd
ticket #316551 migrate to AndroidX, NCMB 4.0.0, UITest.
vfaHungnv Feb 26, 2021
e7158d4
Migrate maven central
vfa-tamhh Apr 9, 2021
1cdec80
Merge pull request #8 from vfa-tamhh/feature_migrate_maven_central
kobo0908 Apr 28, 2021
2d4b2a3
Update build.gradle
shimatani-momoka Sep 6, 2021
5edf05e
Merge pull request #7 from vfaHungnv/master
shimatani-momoka Sep 6, 2021
1dbf3f2
Add .circleci/config.yml
shimatani-momoka Sep 7, 2021
50161cf
add circleci
shimatani-momoka Sep 7, 2021
38941c0
remove key
shimatani-momoka Sep 7, 2021
6f2f263
change build.grade
shimatani-momoka Sep 7, 2021
2072e10
miner change
shimatani-momoka Sep 7, 2021
1d7cc54
miner change
shimatani-momoka Sep 7, 2021
bf21dd1
miner change
shimatani-momoka Sep 7, 2021
88bb55b
miner change
shimatani-momoka Sep 7, 2021
4043694
miner change
shimatani-momoka Sep 7, 2021
4e08abf
miner change
shimatani-momoka Sep 7, 2021
d30faba
miner change
shimatani-momoka Sep 7, 2021
2034cdb
miner change
shimatani-momoka Sep 7, 2021
36b09fb
miner change
shimatani-momoka Sep 7, 2021
21f5753
miner change
shimatani-momoka Sep 7, 2021
5785678
miner change
shimatani-momoka Sep 7, 2021
7bf8d43
remove
shimatani-momoka Sep 9, 2021
b755657
remove
shimatani-momoka Sep 9, 2021
03ee110
add devicefarm
shimatani-momoka Sep 9, 2021
116158e
blank
shimatani-momoka Sep 9, 2021
8d56732
URL
shimatani-momoka Sep 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: 2

jobs:
buildandroid:
working_directory: ~/code
docker:
- image: circleci/android:api-30
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: Set HTML_PUBLIC_URL
command: grep -l 'YOUR_HTML_PUBLIC_URL' $(find `pwd` -name "WebviewActivity.java") | xargs sed -e 's/YOUR_HTML_PUBLIC_URL/"${HTML_PUBLIC_URL:0:-5}"/g'
- run:
name: Download dependencies
command: ./gradlew androidDependencies
- save_cache:
paths:
- ~/.gradle
key: jars-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
- run:
name: add Amazon Device Farm setting
command: cd app && (cat build.gradle | sed 's/\/\*//'| sed 's/\*\///') > tmp_build.gradle && cat tmp_build.gradle > build.gradle && rm tmp_build.gradle
- run:
name: Run Tests
command: ./gradlew lint test
- run:
name: Build debug apk and release apk
command: |
./gradlew :app:assembleDebug
./gradlew :app:assembleDebugAndroidTest
- store_artifacts:
path: app/build/outputs/apk/debug/
destination: artifact-file
- run:
name: AWS DeviceFarm
command: ./gradlew :app:devicefarmUpload

workflows:
version: 2
build_and_test:
jobs:
- buildandroid:
filters:
branches:
only:
- master
- circleci-project-setup
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

24 changes: 0 additions & 24 deletions .idea/gradle.xml

This file was deleted.

46 changes: 0 additions & 46 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

77 changes: 40 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,58 @@
# 【Android】 mBaaSをWebサーバーとして使ってみよう!
_2016/11/30作成_
![画像1](/readme-img/001.png)

## 概要
* [ ニフティクラウドmobile backend ](http://mb.cloud.nifty.com/)の『ファイルストア機能』をWebサーバーとして利用し、保存したWebページを、アプリ内WebViewで表示するサンプルプロジェクトです
* 簡単な操作ですぐに [ ニフティクラウドmobile backend ](http://mb.cloud.nifty.com/)の機能を体験いただけます★☆
* [ ニフクラ mobile backend ](https://mbaas.nifcloud.com/)の『ファイルストア機能』をWebサーバーとして利用し、保存したWebページを、アプリ内WebViewで表示するサンプルプロジェクトです
* 簡単な操作ですぐに [ ニフクラ mobile backend ](https://mbaas.nifcloud.com/)の機能を体験いただけます

## ニフティクラウドmobile backend って何??
スマートフォンアプリのバックエンド機能(プッシュ通知・データストア・会員管理・ファイルストア・SNS連携・位置情報検索・スクリプト)が**開発不要**、しかも基本**無料**(注1)で使えるクラウドサービス!
## ニフクラ mobile backend って何??
スマートフォンアプリのバックエンド機能(プッシュ通知・データストア・会員管理・ファイルストア・SNS連携・位置情報検索・スクリプト)が**開発不要**、しかも基本**無料**(注1)で使えるクラウドサービスです。

注1:詳しくは[こちら](http://mb.cloud.nifty.com/price.htm)をご覧ください
注1:詳しくは[こちら](https://mbaas.nifcloud.com/price.htm)をご覧ください

![画像2](/readme-img/002.png)

## 動作環境

* Android Studio ver. 2.1.2
* Android OS ver. 6.0
* MacOS Mojave v10.14.6 (18G103)
* Android studio: 3.4.1
* Simulator: Pixel 2 Android OS Version 10
* SDK v2系だと動作しないので注意

※上記内容で動作確認をしています。

## 手順
### 1. [ ニフティクラウドmobile backend ](http://mb.cloud.nifty.com/)の会員登録・ログインとアプリの新規作成
* 上記リンクから会員登録(無料)をします。登録ができたらログインをすると下図のように「アプリの新規作成」画面が出るのでアプリを作成します

![画像3](/readme-img/003.png)

### 1. ニフクラ mobile backend の会員登録・ログインとアプリの新規作成
* 下記リンクから会員登録(無料)をします
* https://console.mbaas.nifcloud.com/signup
* 登録ができたら下記リンクからログインします
* https://console.mbaas.nifcloud.com/
* 下図のように「アプリの新規作成」画面が出るのでアプリを作成します
* 既に mobile backend を利用したことがある方は左上の「+新しいアプリ」をクリックすると同じ画面が表示されます
* アプリ作成されるとAPIキー(アプリケーションキーとクライアントキー)が発行されます
* 「OK」をクリックします
* **参考** :APIキーはAndroid Studioで作成するアプリに[ ニフティクラウドmobile backend ](http://mb.cloud.nifty.com/)を紐付けるために使用します。アプリ内でmBaaSを使用する場合には必ず必要になるものですが、今回のサンプルアプリでは使用しません
* 「OK」をクリックすると管理画面が開かれます
* **参考** :APIキーは Android Studio で作成するアプリに[ ニフクラ mobile backend ](https://mbaas.nifcloud.com/)を紐付けるために使用します。アプリ内でmBaaSを使用する場合には必ず必要になるものですが、 __今回のサンプルアプリでは使用しません__

### 2. GitHubからサンプルプロジェクトのダウンロード
* 下記リンクをクリックしてプロジェクトをMacにダウンロードします
* __[AndroidWebViewApp](https://github.com/ncmbadmin/AndroidWebViewApp/archive/master.zip)__
* https://github.com/NIFCLOUD-mbaas/AndroidWebViewApp/archive/master.zip

* ダウンロードしたプロジェクトを解凍します

### 3. Webページの公開ファイルURLを作成する
* 2.でダウンロードしたプロジェクトに「setting」フォルダがあります
* その中にある次の3点のファイルを確認します
* `index.html`
* `mb.png`
* `mb_function.png`
* 2.でダウンロードしたプロジェクト内にある「setting」フォルダを開きます
* 次のファイル3点を確認します
* `index.html`
* `mb.png`
* `mb_function.png`

* この3点のファイルを[ ニフティクラウドmobile backend ](http://mb.cloud.nifty.com/)の「ファイルストア」にアップロードします
* ダッシュボードを開き、「ファイルストア」>「↑アップロード」をクリックします
* この3点のファイルを[ ニフクラ mobile backend ](https://mbaas.nifcloud.com/)の「ファイルストア」にアップロードします
* 管理画面を開き、「ファイルストア」>「↑アップロード」をクリックします

![画像4](/readme-img/004.png)

* 3点のファイルをドラッグ&ドロップします
* 「アップロードする」をクリックします
* ファイルが表示されたことを確認して「アップロードする」をクリックします

![画像5](/readme-img/005.png)

Expand Down Expand Up @@ -83,19 +88,23 @@ _2016/11/30作成_
![画像9](/readme-img/009.png)

### 5. 公開ファイルURLの設定
* `WebviewActivity.java`を編集します
* 先程[ ニフティクラウドmobile backend ](http://mb.cloud.nifty.com/)のダッシュボード上で確認した`index.html`ファイルの「公開ファイルURL」を貼り付けます

![画像10](/readme-img/010.png)
* AndroidStudio で WebviewActivity.kt を開きます
* ディレクトリはデフォルトで「Android」が選択されていますので、「Project」に切り替えてから探してください
![画像11](/readme-img/011.png)

* `YOUR_HTML_PUBLIC_URL`の部分を書き換えます
* このとき、ダブルクォーテーション(`"`)を消さないように注意してください!
* 先程[ ニフクラ mobile backend ](https://mbaas.nifcloud.com/)の管理画面上で確認した `index.html` ファイルの「公開ファイルURL」を貼り付けます
- このとき、ダブルクォーテーション(`"`)を消さないように注意してください

![画像10](/readme-img/010.png)

* 書き換え終わったら保存してください
* Windowsの場合、`Ctrl + S`で保存できます。
* Macの場合、`command + S`で保存できます。

### 6. 動作確認
* AndroidStudioでビルドを行います
* AndroidStudio でビルドを行います
* アプリを起動したら、真ん中の「INFORMATION」ボタンをクリックします
* 画面が遷移し、「公開ファイルURL」で作成したWebページが表示されます

Expand All @@ -106,11 +115,11 @@ _2016/11/30作成_
公開ファイルURLは次のような構造になっています

```
https://mb.api.cloud.nifty.com/2013-09-01/applications/**APPLICATION_ID**/publicFiles/**fileName**
https://mbaas.api.nifcloud.com/2013-09-01/applications/**APPLICATION_ID**/publicFiles/**fileName**
```

### サンプルWebページについて
今回は`index.html`に2つの画像(`mb.png`, `mb_information.png`)を表示する形式で簡易的に作成していますが、JavaScript(`js`ファイル)を作成しファイルストアに保存んすることで、`index.html`にスクリプトを埋め込むことも可能です。
今回は `index.html` に2つの画像(`mb.png`, `mb_information.png`)を表示する形式で簡易的に作成していますが、JavaScript(`js`ファイル)を作成しファイルストアに保存んすることで、`index.html` にスクリプトを埋め込むことも可能です。

### サンプルアプリについて
WebViewの表示は、`WebviewActivity.java`に記述しています
Expand Down Expand Up @@ -150,9 +159,3 @@ public class WebviewActivity extends AppCompatActivity {
}
}
```

## 参考
* 同じ内容の【Objective-C/Swift】版もご用意しています
* [Objective-C]
https://github.com/NIFTYCloud-mbaas/ObjcWebViewApp
* [Swift] https://github.com/NIFTYCloud-mbaas/SwiftWebViewApp
Loading