NodeBB Android App



  • @AOKP I think I can easly order a prepaid creditcard but... Well... meh 😐 the prices...



  • My app is just a simple wrapper for inappbrowser. The files I changed were:

    cd bbs/

    $ cordova platform ls
    Installed platforms: android 4.0.0
    Available platforms: amazon-fireos, blackberry10, browser, firefoxos, ubuntu
    
    $ cordova plugin ls
    cordova-plugin-inappbrowser 1.0.0 "InAppBrowser"
    cordova-plugin-whitelist 1.0.0 "Whitelist"
    

    cat www/index.html

    <!DOCTYPE html>
    <html>
        <head>
            <!--
            Customize this policy to fit your own app's needs. For more guidance, see:
                https://github.com/apache/cordova-plugin-whitelist/blob/master/README.md#content-security-policy
            Some notes:
                * gap: is required only on iOS (when using UIWebView) and is needed for JS->native communication
                * https://ssl.gstatic.com is required only on Android and is needed for TalkBack to function properly
                * Disables use of inline scripts in order to mitigate risk of XSS vulnerabilities. To change this:
                    * Enable inline JS: add 'unsafe-inline' to default-src
            -->
            <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
            <meta name="format-detection" content="telephone=no">
            <meta name="msapplication-tap-highlight" content="no">
            <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
            <link rel="stylesheet" type="text/css" href="css/index.css">
            <title>Hello World</title>
        </head>
        <body>
            <script type="text/javascript" src="cordova.js"></script>
            <script type="text/javascript" src="js/index.js"></script>
        </body>
    </html>
    

    cat www/js/index.js

    document.addEventListener("deviceready", onDeviceReady, false);
    
    function onDeviceReady() {
    	//window.open = cordova.InAppBrowser.open;
    	window.open('http://bbs.kassius.org', '_blank', 'location=no');
    }
    

    cat www/css/index.css

    /*
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements.  See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership.  The ASF licenses this file
     * to you under the Apache License, Version 2.0 (the
     * "License"); you may not use this file except in compliance
     * with the License.  You may obtain a copy of the License at
     *
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing,
     * software distributed under the License is distributed on an
     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     * KIND, either express or implied.  See the License for the
     * specific language governing permissions and limitations
     * under the License.
     */
    * {
        -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */
    }
    
    body {
        -webkit-touch-callout: none;                /* prevent callout to copy image, etc when tap to hold */
        -webkit-text-size-adjust: none;             /* prevent webkit from resizing text to fit */
        -webkit-user-select: none;                  /* prevent copy paste, to allow, change 'none' to 'text' */
        background-color:#E4E4E4;
        background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
        background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
        background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
        background-image:-webkit-gradient(
            linear,
            left top,
            left bottom,
            color-stop(0, #A7A7A7),
            color-stop(0.51, #E4E4E4)
        );
        background-attachment:fixed;
        font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
        font-size:12px;
        height:100%;
        margin:0px;
        padding:0px;
        text-transform:uppercase;
        width:100%;
    }
    
    #bbs-frame
    {
    	position: absolute;
    	top: 5%;
    	left: 5%;
    	width: 90%;
    	height: 90%;
    }
    
    
    /* Portrait layout (default) */
    .app {
        background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
        position:absolute;             /* position in the center of the screen */
        left:50%;
        top:50%;
        height:50px;                   /* text area height */
        width:225px;                   /* text area width */
        text-align:center;
        padding:180px 0px 0px 0px;     /* image height is 200px (bottom 20px are overlapped with text) */
        margin:-115px 0px 0px -112px;  /* offset vertical: half of image height and text area height */
                                       /* offset horizontal: half of text area width */
    }
    
    /* Landscape layout (with min-width) */
    @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
        .app {
            background-position:left center;
            padding:75px 0px 75px 170px;  /* padding-top + padding-bottom + text area = image height */
            margin:-90px 0px 0px -198px;  /* offset vertical: half of image height */
                                          /* offset horizontal: half of image width and text area width */
        }
    }
    
    h1 {
        font-size:24px;
        font-weight:normal;
        margin:0px;
        overflow:visible;
        padding:0px;
        text-align:center;
    }
    
    .event {
        border-radius:4px;
        -webkit-border-radius:4px;
        color:#FFFFFF;
        font-size:12px;
        margin:0px 30px;
        padding:2px 0px;
    }
    
    .event.listening {
        background-color:#333333;
        display:block;
    }
    
    .event.received {
        background-color:#4B946A;
        display:none;
    }
    
    @keyframes fade {
        from { opacity: 1.0; }
        50% { opacity: 0.4; }
        to { opacity: 1.0; }
    }
     
    @-webkit-keyframes fade {
        from { opacity: 1.0; }
        50% { opacity: 0.4; }
        to { opacity: 1.0; }
    }
     
    .blink {
        animation:fade 3000ms infinite;
        -webkit-animation:fade 3000ms infinite;
    }
    


  • Did somebody make it works in android 4? It doesn't let me install it, it always says "there is a problem parsing the package".



  • @Pixel said:

    Did somebody make it works in android 4? It doesn't let me install it, it always says "there is a problem parsing the package".

    Strange. The build target was set to 19, so basically KitKat.



  • @AOKP said:

    @Pixel said:

    Did somebody make it works in android 4? It doesn't let me install it, it always says "there is a problem parsing the package".

    Strange. The build target was set to 19, so basically KitKat.

    I've also tried in another mobile running Android 4.0.4 with no luck, I get the same error. Very strange.



  • @Pixel said:

    @AOKP said:

    @Pixel said:

    Did somebody make it works in android 4? It doesn't let me install it, it always says "there is a problem parsing the package".

    Strange. The build target was set to 19, so basically KitKat.

    I've also tried in another mobile running Android 4.0.4 with no luck, I get the same error. Very strange.

    Thats not KitKat.



  • Works fine on Lollipop, but would be nice if that NodeBB Community bar at the top could vanish. Full screen apps for the win-zip.



  • @AOKP ups, you're right. So I've checked the versions the other mobile is 4.2 (jelly bean?), so it isn't kitkat neither.



  • @a_5mith said:

    Works fine on Lollipop, but would be nice if that NodeBB Community bar at the top could vanish. Full screen apps for the win-zip.

    Same thought, I will make it happen within the next release.

    @Pixel said:

    @AOKP ups, you're right. So I've checked the versions the other mobile is 4.2 (jelly bean?), so it isn't kitkat neither.

    Nope. 😆
    Your phones must be quite old. 😉

    Edit:
    I tried Crosswalk out. It is quite good. Uploading works out of the box, so it is a big benefit.
    However I am not so happy with it's performance and size (25kB vs 20MB). I will see if I can optimize it a bit maybe.

    Edit 2:
    Here a little preview for v2:
    https://community.nodebb.org/topic/6593/test-from-new-webview-app



  • It seems that the link to the apk doesn't work.

    By the way, it is made so that in a future any nodebb forum will be able to be used from the app?
    Thank you



  • Nice application, mind if I do some personal touches to the code? I am an advanced coder with professional work in PHP7, JavaScript, C++, and HTML5.



  • @CreeperFace feel free to do it at anytime!
    @Pixel, yep. It just opens the website inside the app.



  • You can prepare a small document? I have no knowledge 😞


  • Admin

    @AOKP Can you please contact me via email (my first name @nodebb.org)? I'd like to discuss your webview app and see if we can work together on this 😄



  • @julian actually I already have a fully working version on Google Play already. Simply look for Meizufans.



  • @lombisi, sure:
    Click on this.
    Now go to line 30 and replace the URL with yours.



  • @AOKP Should I can not do with Android studio?



  • @lombisi I do not know to be honest.
    However, I would rather go for Eclipse.

    My new APK was compiled in Android Studio though. I will enroll an update till the end of the week, maybe even till Tuesday.

    New features:

    • Navigation Bar
    • Support for Image and File Up- and Download
    • Improved performance
    • "Error" pages (like networking issues)
    • AdMob Support
    • Analytics Support

    I could even add notification support to it over a 3rd party provider.



  • @AOKP Waiting Impatiently 🙂


  • Plugin & Theme Dev

    @AOKP please, just let Eclipse die as an Android IDE 😟 Android Studio is really the way forward.

    You should also consider switching to gradle for your build system. It's the standard for Android development now (for however long that may last). It's also the standard for when you create a new project with Android Studio.
    You should also put gen/, bin/ and .settings/ in your .gitignore.

    So, how long until we see a native application that works with the API? 😉

    If you got any Android development questions, feel free to shoot me a PM. I've got a good year of high quality Android development experience behind me now so I'll answer your questions as soon as I can.


 

Suggested Topics

  • 32
  • 1
  • 5
  • 1
  • 5
| |