Developing with Ionic 2 allows you to efficiently run a background service using Cordova

I am currently using Ionic 2 and I have a requirement for my app to perform certain tasks even when it is closed, similar to how Gmail continues to provide notifications all the time.

After some research, I came across this documentation: https://ionicframework.com/docs/v2/native/background-mode/

However, instead of using a plugin that runs the entire application in background mode, I would like to create a specific service with custom methods that can run efficiently in the background. Can someone guide me on how to achieve this?

Answer №1

To ensure I receive notifications even when the app is closed, I experimented with a solution involving Push Notification using Firebase for Android and APNS for iOS. While this solution was effective, it did come with two drawbacks:

  • Dependence on external services

  • Slight difficulty in configuration

I believe this information may prove helpful to others facing similar challenges. Although I have not delved into how to create a background service, this approach resolved my specific issue.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Determine whether a response is not received within 8 seconds

One of the methods in my Angular component is responsible for returning data Here is a snippet of that method getRecognitionById() { this.loaderService.show(null, true); forkJoin( this.vendorWebApiService.getRecognitionById(this.executiveCh ...

Mongoose: An unexpected error has occurred

Recently, I developed an express app with a nested app called users using Typescript. The structure of my app.js file is as follows: ///<reference path='d.ts/DefinitelyTyped/node/node.d.ts' /> ///<reference path='d.ts/DefinitelyTyp ...

Void com.example in Android Lame has no detected implementation

Hello friends, I am encountering an issue while compiling the Lame Library with the Android NDK tool. I have followed all the steps mentioned in this guide: How to add Lame 3.99.5 to Android Studio using NDK However, when I attempt to use it, I receive t ...

Determining the generic type argument of a class can be unsuccessful due to the specific properties within that class

Why is it that Typescript sometimes fails to infer types in seemingly simple cases? I am trying to understand the behavior behind this. When Typescript's Type Inference Goes Wrong Consider the scenario where we have the following class declarations: ...

When the app is restarted, does Firestore retrieve only the modified documents?

I have some questions about the pricing structure and internal workings of Firestore SDK. If I am using Flutter and running the method firestore.collection('collection_name').get().docs every time I open the app, will I be charged for 1000 rea ...

transform array elements into an object

I encountered the following code snippet: const calcRowCssClasses = (<string[]>context.dataItem.cssClasses).map( (cssClass) => { return { [cssClass]: true }; } ); This code block generates an array of objects like ...

What is the best way to assign values to mat-select in Angular using the component class?

I am currently delving into the world of Angular and experimenting with my own Angular code. HTML Component <mat-form-field class="select-country-component"> <mat-label>Select Country</mat-label> <mat ...

How can main component be hidden or removed from view on specific routes when changing pathways?

In the html template located in my app.component.html file, I have the following code ` <app-layout> <mat-sidenav-container> <mat-sidenav #sidenav role="navigation"> <app-sidenav-list (sidenavClose)="sidenav.cl ...

In a scenario where a specific element is disabled, how can I link its value to another related element?

Setting: Ionic version: 6.20.1 Angular CLI version: 10.0.8 In the process of developing a mobile expense management application, I am working on implementing a feature that calculates the recommended spending for different categories (e.g., home expense ...

Upon refreshing the page, the Vuex store getter displays [__ob__: Observer]

After each page refresh, my Vuex store getter returns [__ob__: Observer]. The version of Vue being used is 2.2.3 along with TypeScript. Initially, the data loads correctly from an external API, but when utilizing the getter, it fails and requires another ...

Issue with importing RxJS in an Angular 5 project

Help needed! I can't find Observable, how do I use rxjs on http? Can someone please provide guidance? import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { IEmployee } from '. ...

What is the process for running a JUnit test on two separate devices using Appium?

I'm curious about running a JUnit test that can target two different devices. I know how to set up Appium to target one device with a specific port, but how can I get JUnit to test two separate devices simultaneously? The setup for Appium on the devi ...

How to Send TypeScript Object Excluding the '_id' Field?

I am currently developing a web app using Express, Mongoose, and Angular 2 (TypeScript). I want to post an instance of MyClass without including the _id field. In mongoose, the _id field is used for various operations in MongoDB. Here is how I have implem ...

Encrypting images using rc4 on an android device

After successfully implementing the rc4 algorithm for encrypting and decrypting texts, I encountered an issue when trying to apply it to images. The result is always an unreadable image with no exceptions thrown. Unsure whether the problem lies in encrypti ...

React did not allow the duplicate image to be uploaded again

I've implemented a piece of code allowing users to upload images to the react-easy-crop package. There's also an "x" button that enables them to remove the image and upload another one. However, I'm currently facing an issue where users are ...

Just a straightforward Minimum Working Example, encountering a TypeScript error TS2322 that states the object is not compatible with the type 'IntrinsicAttributes & Props & { children?: ReactNode; }'

Currently, I am immersed in a project involving React and Typescript. I am grappling with error code TS2322 and attempting to resolve it. Error: Type '{ submissionsArray: SubmissionProps[]; }' is not assignable to type 'IntrinsicAttributes ...

Handling errors within classes in JavaScript/TypeScript

Imagine having an interface structured as follows: class Something { constructor(things) { if (things) { doSomething(); } else return { errorCode: 1 } } } Does this code appear to be correct? When using TypeScript, I en ...

Passing and removing array parameters in HTTP requests using Angular

I have an Array of statuses objects. Each status has a name and a boolean set to false by default. These represent checkboxes in a form with filters - when a checkbox is checked, the boolean value is set to true: const filters.statuses = [ { name ...

Troubleshooting Problem with Dependency Injection in Angular 2 Services

Within my application, there is a Module that consists of two components: ListComponent and DetailsComponent, as well as a service called MyModuleService. Whenever a user visits the ListComponent, I retrieve the list from the server and store it in the Li ...

What is the best way to implement a hover effect on multiple rows within an HTML table using Angular?

I am currently working on developing a table preview feature to display events. I previously sought assistance here regarding positioning elements within the table and successfully resolved that issue. Applying the same principles, I am now attempting to c ...