Coder Social home page Coder Social logo

sample-chrome-restarted-demo's Introduction

sample-chrome-restarted-demo

This sample shows how to detect if a hybrid mobile app is being unexpectedly terminated using Google Chrome APIs in Telerik AppBuilder. You can clone this sample in Telerik AppBuilder, explore and modify the code, and build and run it on Android or iOS devices.

This sample lets you create a new counter on launch and restore any existing counters across app restarts.

Telerik AppBuilder and Chrome APIs

Google provides an Apache Cordova-based toolchain that lets developers wrap a Chrome App in a native container to make it available for Android and iOS devices. For a list of the Chrome Apps APIs that are currently supported for mobile development, click here.

Google provides each API as a custom Apache Cordova plugin that you can import in Telerik AppBuilder. For more information about how to work with custom Apache Cordova in Telerik AppBuilder, click here.

Each Chrome API might depend on another Chrome API or a core Apache Cordova plugin. Telerik AppBuilder automatically resolves Apache Cordova core plugins dependencies but cannot resolve Chrome APIs dependencies. When you develop apps with Chrome APIs and Telerik AppBuilder, always make sure to import all interdependent Chrome APIs. The plugin.xml for the Chrome API lists all dependencies.

Sample Overview

The Telerik AppBuilder team has modified the existing Chrome Restarted Event mobile sample to make it compatible with Telerik AppBuilder. You can find the source Chrome restarted mobile sample here. This sample shows how to detect if the application is being unexpectedly terminated using an onRestarted event. The sample creates a new counter on launch and restores any existing counters across app restarts.

The sample is initialized as a Chrome app. For more information about the development of Chrome apps, including the app container, click here.

All required Chrome APIs, including mobile and desktop APIs on which the app relies, are added as custom plugins.

The sample shows how to use the following methods and objects of the mobile Google Chrome APIs.

  • runtime: Lets you manage the app lifecycle.
  • window: Lets you create windows.
  • storage: Lets you manage recorded data (restarts and others) in the local storage.

Cloning the Sample

You can clone this sample in Telerik AppBuilder, explore and modify the code, and build and run it on Android or iOS devices.

Clone the sample in the in-browser client

  1. Log in the Telerik Platform at https://platform.telerik.com.
  2. Navigate to the workspace in which you want to clone the sample.
  3. Click Create project and select AppBuilder.
  4. Select Clone repository.
  5. In the Repository Uri text box, paste https://github.com/Icenium/sample-chrome-restarted-demo.git.
  6. Provide a project name.
  7. (Optional) Provide a project description.
  8. Click Create project.

Clone the sample in the Windows client

  1. Run the Windows client and log in.
  2. In the Dashboard, click Clone.
  3. From the Workspace drop-down list, select the workspace in which you want to clone the sample.
  4. In the Repository Uri text box, paste https://github.com/Icenium/sample-chrome-restarted-demo.git.
  5. Provide a project name.
  6. Click Clone.

Clone the sample in the extension for Visual Studio

  1. In your browser, navigate to https://github.com/Icenium/sample-chrome-restarted-demo.
  2. Click Download ZIP, store the archive on your local file system and extract it.
  3. In {{ms-vs}}, create a new project from the Blank template.
  4. In the Solution Explorer, select the css, img, js, and App_Resources folders, and the index.html file.
  5. Press Delete and confirm that you want to delete the selected files and folders.
  6. In Windows Explorer, go to the folder where you extracted the sample app and navigate to the subfolder that contains index.html.
  7. Select all files and folders except *.proj and cordova.*.js.
  8. Drag the selection to the Solution Explorer in {{ms-vs}} and drop it on your project node.
  9. If prompted, confirm that you want to replace the existing files.

Clone the sample in the command-line interface

  1. In your browser, navigate to https://github.com/Icenium/sample-chrome-restarted-demo.
  2. Click Download ZIP, store the archive on your local file system and extract it.
  3. Run a command prompt, log in, and navigate to the folder that contains the PROJ file for the sample app.
  4. Run $ appbuilder init.

The command-line interface shows the following message: Successfully initialized project in the folder!

Running the Sample on Device

You can run this sample on iOS 7.0 and later devices and Android 4.0 and later devices. You cannot run this sample in the Telerik AppBuilder companion apps or the Telerik AppBuilder device simulator.

With Telerik AppBuilder, you can deploy apps on device wirelessly or via cable connection. For more information about running apps on devices, click here.

License

This sample is licensed under the Apache License, Version 2.0. For more information, see License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.