Development Tip: Custom Icon for Push Notifications

One way to customize your app is to use a custom push notification icon. By the default, the push notification icon is your app icon.

Setting a custom icon for incoming push notifications is available only for Android OS and only for version 3 libraries (jQuery Mobile).

To set a custom push notification image:

  1. Upload your custom image (for example: icon.png) into the ANDROID/project_name/res/drawable/ folder to set it as a push image. If there is no drawable folder, simply create it:
    icon
  2. On the Source tab, open the WEB_RESOURCES > app > startScreen.js file.
  3. Find the PushNotification.init function and add an icon property with 'icon' value:
    code
  4. Now your app has a custom push notification icon!

Read more about Appery.io push notifications in our documentation and make sure to check out all of our mobile development tips.

Do you want to build apps fast? Start developing with our trial plan!

How to Send and Read Data from a Push Notification Message

In this post, we’ll show you how to open a URL received in a push notification message for both jQuery Mobile and AngularJS apps.

This tutorial assumes you are familiar with how to send and retrieve push notifications. If you are not, this tutorial will show how to send your first push notification message.

Let’s start with a jQuery Mobile app.

To open a URL when a push notification message is received, use the Load page event and add the following JavaScript code:

$(document).on("push-notification", function(event, data) {
   window.open(data.message, "_blank");
});

This is how the event looks in the App Builder:

Screenshot_4

Code to read Push Notification message and navigate to a URL

Read the rest of this entry »

Appery.io Under the Hood Part 1: RequireJS and AngularJS

In the “Appery.io under the Hood” series, we’ll be explaining in detail how Appery.io works. We hope that this information will give you a deeper insight into how to make better apps by giving you a deeper understanding of the platform.

Loading resources when needed

When developing big scalable web apps, the question of how to manage tons of libraries and services arises pretty quickly. There are a few key reason why a powerful and flexible dependency management tool becomes mandatory:

  • The vast majority of libraries dictate their own requirements for dependencies. This makes it critically important to load and launch resources in the appropriate order
  • Loading all the libraries and other resources at once increases network traffic and should be avoided when possible. This is even more important for mobile apps
  • App loading time can be significantly decreased when loading only the required libraries:
    • A ready event will be fired only once for all the required resources
    • For mobile devices and apps, page size can be optimized as much as possible to prevent browser or OS failures
    • Overloading the device CPU by loading unnecessary libraries will decrease battery life
  • The bigger the development team, the more complicated library dependency management becomes

This is why Appery.io has chosen RequireJS to solve the cumbersome process of dependency management. Let’s see how RequireJS is used in Appery.io apps.

RequireJS

RequireJS implements an AMD (Asynchronous Module Definition) approach and allows the declarative description of dependencies among app modules. RequireJS also guarantees that all module dependencies will be resolved before module execution. In the AMD pattern means each module has its own isolated variables area. This makes your app more stable by reducing the possibility of namespace conflicts. 

Read the rest of this entry »

Learn How to Display a PDF File in Your Mobile App from a Database

We are often asked about displaying a PDF file in a mobile app. In this tutorial, you’ll learn how to display a PDF file uploaded to the Appery.io cloud database in your mobile app.

First, upload the PDF file into the Files collection of your database. You can use any existing database or quickly create a new database.

 

filesCollection_upload

Appery.io Database Files collection

Read the rest of this entry »

Development Tip: Creating App Routing for an AngularJS Apps

routingConfiguring your app routing is really easy with the Appery.io Routing tab. You can find it under Project > Routing. When creating a new page, a route for it will be created automatically. You can then change its name or select needed dependencies, which is really convenient.

Then, in your code, you can get to that page using Route name this way:

Apperyio.navigateTo("Screen2");

Routes with dynamic parameters are available as well. You can find out more about it (and, generally, about the Appery.io routing feature) in our documentation.

Make sure to check out all of our mobile development tips.

Do you want to build apps fast? Start developing with our trial plan!

How to Install and Use the Cordova Background Plugin for Route Tracking

Every Appery.io app comes with the Apache Cordova library automatically installed. This means you have access to default Cordova APIs such as Camera, Contacts, Geolocation, and more. Many users also wanted to add 3rd-party Cordova plugins to the app. To make this process very simple, we’ve added a simple wizard. In this tutorial you are going to learn how to upload a Cordova plugin to your app and use it. You will build an app that will track your route and draw it on a map. The app will do this in the background. (This is a popular feature in fitness apps.)

Read the rest of this entry »

PayPal Secure Payments for Your Ionic & AngularJS App

paypal_logoPayPal API is one of the most popular Appery.io plug-ins, and now it’s also available for Ionic & AngularJS!

Our users have frequently requested the ability to add payments to their Ionic & AngularJS mobile apps more quickly, for example, to create an online shop. Now, with the help of this plug-in, you could build an online shop (for instance) to be used by your Ionic & AngularJS app really easily.

A few notes about the security implemented in this app:

  • Authentication with PayPal occurs via a Server Code script. It takes your PayPal app credentials and sends XHR to PayPal. The token is stored to the database.
  • By using the Secure Proxy feature, the actual token value will be substituted on the server side. This way any PayPal API can be triggered.
  • Because of the server-based authentication, sensitive data such as the client secret or token value will never be shown in the app, which eliminates the possibility of theft.

Finally, a few, more general, notes:

  • The flow implemented in this plug-in is similar to PayPal’s flow.
  • We have a PayPal API plug-in tutorial here. Check it out to configure the plug-in.
  • The plug-in is configured for a test environment, so use the PayPal guide too see what you need to do when going live.

Development Tip: Managing Your App Images With Media Manager

media_manager

The Media Manager allows you to work with image files in the App Builder. You can upload, rename, and delete images, as well as select them as assets for the Image component. You can open the Media Manager by clicking “additional menu” (the “three lines” button) in the upper-right corner of the builder and select “Media Manager”:

media_manager_icon

Opening the Media Manager

For example, you can upload your image through the Media Manager and use it as a custom page background via CSS (don’t forget to add the appropriate CSS class to the page):

.background
{
    background-image: url('../files/images/background.png');
}

Learn more in our documentation, and make sure to check out all of our mobile development tips.

Do you want to build apps fast? Start developing with our trial plan!

Development Tip: Displaying and Centering a Spinner in an Ionic App

With Appery.io and Ionic, you can easily add a spinner to a page:

  1. Drag’n’drop the spinner component to a page.
  2. Provide an expression for ng-show in the properties panel. It could be a variable that returns true or false.
  3. To vertically and horizontally center the spinner do the following:
    1. Add a centered-spinner class to Class in the properties panel.
    2. Create new CSS by going to CREATE NEW > CSS > Create CSS.
    3. Add the following code to create the CSS file:
.centered-spinner {
    width: 28px;
    height: 28px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -14px;
    margin-left: -14px;
}

.scroll
{
    height:100%;
}
spinner
Ionic spinners

Your spinner is ready to use! Don’t forget to change the variable provided for ng-show to true when you need to show the spinner, and to false when you need to hide it.

You can find related information here or here.

Make sure to check out all of our mobile development tips.

Do you want to build apps fast? Start developing with our trial plan!

How to Build a Mobile Chat App with Ionic, Server Code and EventSource API in Appery.io

The Appery.io platform comes with many visual tools to help you build your mobile app fast. We understand that there are cases where you need to go beyond visual tooling and be able to customize your app with code. There are a number of ways to do that in Appery.io.

  • You can write any custom JavaScript code in the app (client). You can also include any 3rd party libraries.
  • With Appery.io Server Code you can develop any custom logic on the server, also using JavaScript. This logic is automatically exposed via a REST API. That’s like creating a custom API on the fly.

In this tutorial we are going to show you how to combine the visual tools with custom code to build a chat mobile app. In particular, you’ll learn how to use EventSource API to receive server-sent events and create a simple chat application. The app will be based on the Ionic Framework and also use Server Code script. The app looks like this:

IonicChat

Chat app

 

Read the rest of this entry »