CordovaでAndroidプッシュ通知アプリを作る②
カテゴリ:Code Archives, Cordova, HTML/CSS/JS, Mobile, Push App 投稿日:2017年1月24日プロジェクトのルートファイルにあるconfig.xmlの設定。
config.xml
<?xml version='1.0' encoding='utf-8'?> <widget id="com.cutls.myapp" version="[アプリのバージョン(初期:1.0.0)]" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>[アプリ名]</name> <description> [アプリ説明文。Google Playなどとは関係ない] </description> <author email="[メアド]" href="[Webサイト]"> [開発者名] </author> <content src="[スタートページ(初期:index.html)]" /> <plugin name="cordova-plugin-whitelist" spec="1" /> <access origin="[ホワイトドメイン。アプリ内からAjaxするときは必須です。]" /> <!--ここからは個人的に任意だと思っています。--> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> <allow-intent href="tel:*" /> <allow-intent href="sms:*" /> <allow-intent href="mailto:*" /> <allow-intent href="geo:*" /> <platform name="android"> <allow-intent href="market:*" /> </platform> <platform name="ios"> <allow-intent href="itms:*" /> <allow-intent href="itms-apps:*" /> </platform> </widget>
そしてこれが書き終わったら忘れずに
cordova prepare -d
しておく癖をつけましょう。
今回使うプラグインはPushPluginです。
Gitを使います。Git for WindowsをDownloadして、
このような要領で進めていきます。
GUIはオフに
コマンドプロンプトで
デフォでOK
コマンドプロンプトで、その2
そして、追加します。
cordova plugin add https://github.com/phonegap/phonegap-plugin-push.git
プラグインの確認はここで
cordova plugin ls
一例
次回はプラグインの実装についてです。