Apache Cordova: Package/Build iOS/Andorid App from Polymer HTML5 Project

Categories: AndroidDevelopment NotesHTML5; Tagged with: ; @ July 21st, 2015 23:14

Requirement: Build iOS/Android app using existing Polymer project.

Solution:

There’re lots of tools/platforms to build an app from HTML5 project, such as Trigger.io, Intel XDK, PhoneGap, Apache Cordova. I choosed Cordova to build my first html app;

  1. Install Apache Cordova by npm:
    $ sudo npm install -g cordova
  2. Create a Cordova project using cordova CLI;
    $ cordova create hello com.liguoliang.app HelloWorld
  3. Navigate to the project folder, add platform:
    $ cordova platform add ios/android
  4. Build project:
    $ cordova build
  5. Emulate the app:
    $ cordova emulate ios/andorid

Note: It is required to install Xcode or Android SDK/Tools for simulating.  you may follow the Cordova CLI message to installed the required sdk/tool.

> Apache Cordova CLI Document

ios-polymer-app

Polymer helloworld: create web component using dom-module

Categories: Development NotesHTML5; Tagged with: ; @ July 19th, 2015 23:10

Requirement:  creating a component to display user info

Step 1:  Create a web component using dom-module:

user-info.html:

<link rel="import" href="../bower_components/polymer/polymer.html" />

<dom-module id="user-info">
    <template>
        <div id="container">
            Hi, <span>{{user_name}}</span>!
        </div>
    </template>

    <style>
        #container {
            font-size: 11px;
            color: gray;
        }

    </style>

    <script>
        Polymer({
            is: 'user-info',
            properties: {
                user_name: {
                    type:String,
                    value:"Mr.default"
                }
            }
        });
    </script>

</dom-module>

Step 2: Use the newly created component:

<link rel="import" href="components/user-info.html" />
<template is="dom-bind">
    <user-info user_name="Li"></user-info>
</template>

Curl – HttpPost Example

Categories: Development Notes; Tagged with: ; @ June 13th, 2015 0:34

Http Post without Parameter

$ curl -X POST -H ‘Content-Length: 0’ http://127.0.0.1:8080/_qs/listAllInstitutions

Set content-Lenght=0 to avoid HTTP ERROR 411 – ‘Length required’

 

Http Post with Parameters

curl  –data “userId=user-id”  http://127.0.0.1:8080/_qs/getUserInfo

Android: Cloud Messaging Hello world using GCM, AWS SNS and Parse

Categories: AndroidDevelopment NotesJava; Tagged with: ; @ May 24th, 2015 23:12

Quick start using GCM

0. Create your project via “Google developers console”;

1. Prepare Client App:

  – Get device registration ID

– Receive message from GCM

Example: https://github.com/hmkcode/Android/tree/master/android-gcm-client

2. Send Message to GCM server

– Send(Post) message to GCM server
Example: https://github.com/hmkcode/Android/tree/master/java-post-gcm

3. Start your app(#1), then send message ( #2)

 

Push message via AWS SNS to Android devices

Login to AWS console

1. Create new application with your GCM API key

2. ‘Create platform endpoint’ using your device registration ID;

3. Select your device and ‘Publish to endpoint’ to publish a message

4. Check your device;

 

Push Message via Parse Push

Need to modify the client app and then push message from Parse console;

Jenkins: How to build bitbucket private project

Categories: Development Notes; Tagged with: ; @ May 16th, 2015 12:10

Update on Jan 8, 2017

You may enter your private key directly in Jenkins “Configure Credentials”.  so that you don’t need to config your server/box.

Config your build server

0. su – jenkins  (sudo su -s /bin/bash jenkins) // no need for Windows

1. Generate RSA key:  ssh-keygen

2. Add public key to your bitbucket profile

for 1 and 2, You may follow this instruction:https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

3. [Optional] try to do a git clone, make sure you can clone your project

 

Config your jenkins:

1. Install git plugin for you jenkins

2. config your jenkins job to use git repo: e.g.   [email protected]:user/project.git

Issues:

Failed to connect to repository : Command “git -c core.askpass=true ls-remote -h [email protected]:user/project.git HEAD” returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You may add bitbucket.org to your know_host by executing:

git ls-remote [email protected]:accout/project.git
...
Are you sure you want to continue connecting (yes/no)? yes

Newer Posts <-> Older Posts



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.