一、目录结构
二、新建app-xiang文件夹
1、 manifest.json文件
{ "package_id" : "com.modou.xiang", "name" : "app-xiang", "display_name" : "电子相框", "author" : "tingpan", "author_mail" : "[email protected]", "homepage" : "modouwifi.cn", "version" : "0.0.1", "os_version" : "1.3.01", "release_date" : "2015.06.22", "location" : "internal", "description" : "这是一个电子相框", "instruction" : "这是第一个版本", "autostart" : false, "start_on_boot" : false }
2、 init
#!/bin/sh curdir=$(cd $(dirname $0) && pwd) PWD="$(cd $(dirname $0) && pwd)" TITLE="电子相框" PROGRAM_NAME="app-xiang" ICON="res/icon.png" PRESSED_ICON="res/icon_p.png" APPS_CONFIG_DIR="/data/conf" LAUNCHER_CONFIG_DIR="$APPS_CONFIG_DIR/launcher/conf.d" LAUNCHER_CONFIG_FILE="$LAUNCHER_CONFIG_DIR/$PROGRAM_NAME.conf" INSTALL_BIN="/usr/bin/install" REMOVE="/bin/rm -f" usage() { echo "ERROR: action missing" echo "syntax: $0 <start|stop|restart|status|config|install|uninstall>" } install() { echo "{" > "$PROGRAM_NAME.conf" echo "\"name\" : \"$TITLE\"," >> "$PROGRAM_NAME.conf" echo "\"icon\" : \"$PWD/$ICON\"," >> "$PROGRAM_NAME.conf" echo "\"iconPressed\" : \"$PWD/$PRESSED_ICON\"," >> "$PROGRAM_NAME.conf" echo "\"exec\" : \"$PWD/init run\"," >> "$PROGRAM_NAME.conf" echo "\"msgNum\" : 4" >> "$PROGRAM_NAME.conf" echo "}" >> "$PROGRAM_NAME.conf" $INSTALL_BIN -d $LAUNCHER_CONFIG_DIR $INSTALL_BIN "$PROGRAM_NAME.conf" "$LAUNCHER_CONFIG_FILE" } uninstall(){ $REMOVE "$LAUNCHER_CONFIG_FILE" } run(){ #textview2 -t "hello" -m "hello world" #textview2 -t "hello" -m ${curdir} imageview ${curdir}/res/qi_224_240.png 224 240 & sleep 5 killall imageview imageview ${curdir}/res/sheng_320_240.png 320 240 } case "$1" in "start" ) start;; "stop" ) stop;; "run" ) run;; "restart" ) start stop;; "install" ) install;; "uninstall" ) uninstall;; "set_config" ) set_config;; * ) usage ;; esac
3、 res文件夹下放入如下png图片,
注:icon.png和icon_p.png像素为111x111
mpk包及源码下载:
http://pan.baidu.com/s/1eQniLRc
参考:
https://gitcafe.com/Modou/app-framework
https://gitcafe.com/hdcola/ModouAppDevTutorial/tree/master/app-helloworld0.0.1
时间: 2024-11-03 22:52:26