How to Save Camera Images in an Ionic App

This short tutorial will show you how to save images from your device camera into Appery.io database.

  1. Create a new Ionic project and database.
  2. Add the Camera Service plug-in and File Upload App plug-in into the project by going to Project > CREATE NEW > From Plug-in, in the Builder.
  3. Create a page CameraPage with 2 buttons Camera and Upload with corresponding attributes and the component Image to display the result:
  4. On the Scope tab add this code for the Camera button:
    var requestData = {};
    Apperyio.get("Camera_getPicture")(requestData).then(
    function(success){
        $scope.im.image = success.image;
        $scope.$apply(); 
    },
    function(error){
    });

  5. Then, add this code for the Upload button:
    function dataURLtoFile(dataurl, filename) {
    var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1],
    bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
    while(n--){
    u8arr[n] = bstr.charCodeAt(n);
    }
    return new File([u8arr], filename, {type:mime});
    }
    
    var filepointer = dataURLtoFile($scope.im.image, 'test.png');
    $scope.files.push({filename:"test.png", filepointer: filepointer});
    
    
    if ($scope.files.length === 0) {
    alert('No file for upload');
    return;
    }
    
    var requestData = Apperyio.EntityAPI('FileDB__files_upload_service.request');
    var user_scope = $scope.user;
    var files_scope = $scope.files;
    var formData = new FormData();
    requestData.data = _.pluck($scope.files, 'filepointer');
    
    Apperyio.get("FileDB__files_upload_service")(requestData).then(
    
    function(success){
    alert('All files has been successfully uploaded.');
    },
    function(error){
    
    },
    function(notify){
    
    });
  6. Finally, enter tour database_id and master_key in  FileDB_settings:

And, that’s it! (Please remember that this app should be tested on a real device.)

Changes to Appery.io Tester App for iOS

Our Appery.io Tester App for iOS has been updated and now includes the new Cordova version.

Release Highlights:

  • Cordova iOS 4.5.5
  • Added Ionic 3 support
  • fix minor bugs

Update or re-install Appery.io Tester App on your device. In our upcoming Appery.io release, we will update both Android and iOS Cordova platforms versions.

What’s in the March 2019 Platform Update (Psssst… PWAs)

Our March platform update rolls out on March 10. It will be focused on support for progressive web apps (PWAs).

PWAs are a new software development technology. Like other hybrid solutions (Cordova, Electron, etc), PWAs work seamlessly on desktop, mobile, and tablets using a single source codebase.

“Progressive web applications (PWAs) are web applications that load like regular web pages or websites but can offer the user functionality such as working offline, push notifications, and device hardware access traditionally available only to native applications. PWAs combine the flexibility of the web with the experience of a native application.” © Wikipedia

If you are still using a classic hybrid application, you have to  make a build for every platform you want to support and then distribute your application to an app market like Google Play or App Store. That means you need to register a developer account, buy platform-specific hardware and software, build and test your application for every platform, and then publish your application to the market. Once done, your application can be removed from the application market by a vendor if it doesn’t pass their review processes.

A PWA has the advantage that you are the only person who manages your application. All you need to publish your application is to be the host. If you are an Appery.io customer, you can do this in just a few clicks. Below, we describe how to do this.

Here is a checklist from the Google Developers site that walks you through how to convert existing apps to PWAs. With Appery.io, it’s not necessary to do this, but this is a helpful resource just in case.

We have added a PWA option for all project types supported by Appery.io. You don’t need to change any code in your existing app to make it a PWA.

Just open your app in the AppBuilder and configure the PWA settings like application name, icon, background color, etc.

The next step would be publishing your app.

PWA App Publishing.

Now, anyone who opens your app published in a web browser on a mobile device will be able to add it to the launch screen without installing it from the application market.

How to Build a Sample Ionic 3 Search App

This is a continuation of the post How to Build a Sample Ionic 3 List App. In this document, we will provide step-by-step instructions on modifying your Ionic 3 list app so that data can be shared between its pages.

Remember, you can only proceed with the steps in this post only after you have made sure the application from the previous post works as expected.

  1. To begin with, go to the Databases tab and open the database to be used in the app. Make sure the needed collection has a column of string type named description. If needed, create it by clicking the +Col button and filling it with data:
  2. Once done, switch to the Apps tab and open the Sample Ionic 3 app created in the previous blog post. In the Project view tree, click Model. There, define the models so that they look like the following (note that, here, the SingleItem model is renamed to Item):
  3. A Query service from the collection should be imported in this step: Create new > Database Service; in the new window, select the database and check the Query service checkbox of the needed collection. Click Import selected services to confirm: The subfolder with the corresponding name should now have been added to the Services folder in the Project view tree.
  4. It is time to add a new pageCreate new > Page, set the page name to Details, and confirm by clicking Create Page.
  5. Under the PROPERTIES tab, change the Navbar Text component to Details.
  6. Drag and drop a Text component on the page and define its Text property as {{name}} selecting h1 for the Container property.
  7. Now, add another Text component to the page and set its Text property to {{description}}:
  8. Switch to the CODE tab, click Edit internal includes, and, in the pop-up window, scroll down to find { NavParams } from “ionic-angular”. Then check it and confirm the selection by clicking Save:
  9. Then, proceed to the Variables section adding and defining variables as follows (ensure the private navParams variable is checked in the Add DI checkbox):
  10. To finish with the Details page, add a new function to it, name it constructor, and define it with this JavaScript code:
    this.name = (this.navParams.get('name') || "").toString();
    this.description = (this.navParams.get('description') || "").toString();
  11. In the next step, some changes to the existing List page should be made. So, in the DESIGN view, under the PROPERTIES tab, select the Navbar Text component and rename it to List.
  12. Now, place the Input component on the page and define its [(ngModel)] property as query.
  13. Modify the existing List item by adding a new attribute (click)navCtrl.push(“Details”, item):
  14. Rename the Button Text property to SEARCH and change its (click) attribute to search() that will initiate navigation to the other page (Details) of the app (if you decide to keep the list functionality in the new app, create a new button for search so that there will be two of them):
  15. Once done, open the CODE tab and click Edit internal includes. Check 2 dependencies: { NavController } from “ionic-angular” and your added query dependency (the last on the dependencies list) in the Dependencies pop-up window. The List service can be unchecked now if not used for the modified app.
  16. Save. The services with the corresponding names should now be added under Internal includes:
  17. After that, add 2 variables: query of type String and queryService of the type of your query service (added to Internal includes). Make sure the Add DI checkboxes for private navCtrl and queryService variables are checked. (Delete the listService variable if it will not be used in the app.)
  18. Finally, add a function to the page named search and define it with this JavaScript code (the loadList function will not be used so it can be deleted):
    let query = this.query || "";
    
    this.queryService.execute({ // change 'MerchandiseDB_New_InStock_query_service' to actual variable name//
        data: {
        },
        params: {
            where: JSON.stringify({name:{ $regex: query, $options: "i"}})
        },
        headers: {}
    }).subscribe(
        (res: any) => {
            this.items = res
        },
        (err: any) => {
            console.log(err)
        }
    )
    

    Voilà!

    The app is ready for testing. Click the arrow button next to the Test menu item. In the drop-down, select Show without frame and click Launch. The List page will be loaded. Enter the name of the item from your database collection (for example, Coat) and click SEARCH. The item Coat will be returned on the page. Then, click this item to open the Details page with the item description:

    Note: You might also want to leave the List service functionality created earlier. In this case, both List and Query services should work as expected.

Update from Google Play

We would like to inform you that Google has updated their Developer Policy to make apps published with Google Play compliant with user Privacy, Security, and Deception policy and now restricts the use of high risk or sensitive permissions, including the SMS or Call Log permission groups.

Please review these permissions in your Appery.io project(s) on the App Settings page (Project->App Settings->Android Permissions).

If such permissions are not used by your application but are enabled, please disable them. Once done, upload an updated app version to Google Play to ensure it will be allowed by Google.

If your application requests the use of such permissions, you will be required to submit the Permissions Declaration Form to receive approval from Google Play. Once your Permission Declaration is reviewed and your app is approved for policy compliance to the Google Play Developer Distribution Agreement, your application will be published.

Note:

Completing the form is required even if the application does not use such permissions, so please select any items there and add a comment like: “I’ve selected one just to submit a form, the app doesn’t require that feature”.

How to Build a Sample Ionic 3 List App

This post will describe step-by-step how to build a sample app with Ionic 3 that will retrieve a list from your database collection.

  1. Create a new Ionic 3 app. From the Apps page, click Create new app > Ionic 3 (beta), give it a name, and click Create.
  2. Import the List service from any existing or newly created Appery.io database collection. Create new > Database Service, select the needed database and check the List service checkbox confirming import.
    The subfolder with the corresponding name should now have been added to the Services folder in the Project view tree.
  3. Add a model called SingleItem of type Object and 2 attributes: name and _id. Then, add the Items model of Array type and define it in the following way:
  4. Open Pages and rename Screen1 to List using the “cog” sign.
  5. Under the DESIGN tab, add a List component to the List page and delete the 2nd and 3rd items on the list.
  6. Select the List item and add the property *ngFor=let item of items. Also, set the Text property to {{item.name}}.
  7. Now, add a Button component to the page, select it, and define its Text property as Load List and (click) property as loadList().
  8. Switch to the CODE tab, click Edit internal includes, check your added list service, and save:The service with the corresponding name should now be added under Internal includes.
  9. Add 2 variables: items of type Items and listService of the type of your list service (added to Internal includes). Check the Add DI checkbox for listService.
  10. Finally, add a function, name it loadList, and define it with this JavaScript code:
    this.listService.execute({ // change 'MerchandiseDB_New_InStock_list_service' to actual variable name//
        data: {},
        params: {},
        headers: {}
    }).subscribe(
        (res: any) => {
            console.log("res = ", res);
            this.items = res;
            console.log(res);
        },
        (err: any) => {
            console.log(err)
        }
    )
    

Voilà!

You can now test your app. To do so, click the arrow button next to the Test menu item. In the drop-down, select Show without frame and click Launch. The page will be loaded. Now, click the Load list button. The list appears loaded with the items from the database:Note: To learn how this app can be modified to search and share data across its pages, proceed with this post.

Upcoming Pricing Update – Consider Subscribing at Today’s Price!

We haven’t changed our pricing for 2.5 years while keeping the pace of developing new exciting features of Appery.io. In fact, almost entire API Express as well as Ionic 3 editor were introduced during that time period and more new features are coming! We are very close to release PWA support and in Q2 we will release Ionic 4 editor with a set of nice codeless features. On February 10 we will slightly update Pro plan pricing to keep up with rising AWS and development cost. No other plans will be affected. We are grandfathering all existing pro plan subscriptions, so if you are a current Pro plan customer before February 10, your price will not change, unless you make a change to your subscription.

Note that any change in the plan (such as adding or removing users, or stopping and restarting your subscription) will require moving to the new Pro pricing plan.

The upcoming pricing, as of February 10, is as follows:

Billed Annually Billed Monthly
 Pro $70/month $99/month
 Team (unchanged) $135/month $200/month

The new Pro plan pricing compares to today’s price of $90 (billed annually) and $60 (billed monthly).

Additional User Seat Pricing is unchanged. The pricing of new user seats is the same, regardless of the plan and unchanged as shown below.

Billed Annually Billed Monthly
 Additional User (unchanged) $30 $40

There are no other changes to the plans. The allocation of resources such as projects, API calls, push notifications and storage space will all remain the same as before.

Consider Subscribing Today!

If you are considering subscribing to the Pro plan whether monthly or annual, you should consider subscribing before February 10 to lock in the lower price!

If you have questions, please don’t hesitate to reach us at support@appery.io

Go Digital on a Shoestring Budget with Appery.io PWAs

A Progressive Web App (PWA) is the most cost-effective way to go on the market fast with a mobile app. It can help dramatically save on development and maintenance if you compare a PWA with a native app. PWAs take advantage of the open standards offered by web browsers to provide the benefits of a rich mobile experience.

Sample PWA

This sample Appery.io PWA developed in 16 hours looks like a native app and can work offline.

Native-like mobile experience

Surf over in iOS Safari or Android Chrome to https://pizza-pwa.app.appery.io/ and add the opened page to your phone’s home screen to create a seamless native-like mobile experience.

Please note that changing the demo database content is disabled.

Working offline

A service worker (a script staying behind the scene) uses a cache mechanism to manage HTTP requests. Opening the app for the first time online saves all the data on to the device automatically. When offline, searching and listing stay fully functional effortlessly. (Please note that iOS 11.4.1 provides limited support of this feature.)

Programming a PWA

Making a PWA is as easy as 1, 2, 3 with Appery.io‘s support for the development of Ionic 3, Ionic 1, and JQuery apps. Just pick the Ionic 3 option to start developing a PWA. To review or reuse the sample Pizza PWA download this zip archive. The demo app consists of:

  • HTML5 pages
  • A service worker
  • An Appery.io Mongo database
  • A JSON-based manifest

After restoring it into Appery.io, make sure that the app refers to a valid database, and the appropriate plug-in is installed. Once all these steps are taken care of, run the building process. Voilà, the demo app is ready for testing.

Testing a PWA

Google published a checklist that breaks down all the things that are important in order to develop a basic PWA. And, the checklist shows you how to go further to make a truly advanced PWA, one that provides a more meaningful offline experience and reaches interactivity even faster, along with other improvements.

For verification of many items on this checklist, Google suggests using the Lighthouse tool.

In addition, the following tools can be utilized to validate some items on the checklist:

  • Selenium and other WebDriver-based frameworks
  • Headless browser tools like Google puppeteer, PhantomJS, and JSDom
  • Appium and Espresso

Are you up to developing a PWA? Then start using Appery.io for FREE!

The September Release with Ionic 3 Support Has Arrived!

The September release for the Appery.io mobile app platform has just been rolled out. This announcement post will be very short…because we have only one main update. Here it is:

Ionic Version 3 Support

You asked, and we heard. Support for the latest version of this advanced framework has been added into Appery.io. We now support Ionic 3 with all its features. For now, the platform support for Ionic 3 is in beta, but fully usable. Also, you won’t have to abandon your existing projects in Ionic as Ionic 3 will appear as a separate framework.

Hacking a Hackathon with Appery.io

A hackathon is usually an all day long coding competition where a motley team of software programmers, developers, and designers sit together to design and develop something quickly. The goal of a hackathon is to create usable software in the least amount of time. In order to avoid the burden of building infrastructure and steep learning curve issues, many hackathon attendees (“hackathonees”) search for a Swiss army knife to use.

Luckily, with Appery.io, a cloud-based rapid software development platform, hackathonees satisfy all of these goals. Among them are top-notch companies such as a the largest bank in the Middle East, a worldwide healthcare company, and a global hackathon organization that has already fueled many internal and public codefests with Appery.io.

Concentrate on Innovation Not Infrastructure

Appery.io has integrated mobile back-end services, including database, push, and server code. In addition, it can be used to easily and securely integrate apps with any back-end system. Offline synchronization is included, too. And, dozens of free out-of-the-box plugins are available.

Smooth Learning Curve

According to the Appery.io community members, it takes just 2 to 3 days for a novice to master the platform and start building functional hybrid apps. (Of course, some basic knowledge of JavaScript, HTML, CSS, and databases are nice to have to make the learning curve shorter.) In addition, the platform has tons of well-organized DIY videos and manuals as well as free downloadable sample apps.

Easy to Start

Here is a five-minute video showing how to build a mobile app with a cloud database from A to Z.

Are you a hackathonee? Start using Appery.io for FREE!