App is run forever

what did you get in alert?
If you did get any id then try sending push notification now.

I get id.after try to send notifications.Still my device not receive any notifications.and display the err msg on site

The selected segments do not have any users

Are you running your app on real device?

No my app running on emulator

I think that’s why you are not getting push notification.
Try running that on real device.

@ravi_sojitra.It’s work. app is running or Closed.I closed my app and going to app settings->App->No more apps are running.after i send notifications does not receive.why?I need everytime receive notifications

If you force close your app. no app will receive notification.

@ravi_sojitra How to use Rest API for onesignal can u pls help me.

This is how i do it.

    $content = array(
                  "en" =>'notificationDescription'

    $fields = array(
      'app_id' => "YOUR OneSignal App ID",
      'include_player_ids' => array($device_token), // that id you are getting in alert with getIds function
      'data' => $notificationData, //if you want to send data ,payload
      'contents' => $content,

    $fields = json_encode($fields);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "");
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8',
                           'Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXXXXX')); //you REST API Key from one signal
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

    $response = curl_exec($ch);
    return $response;

I am using postman . i am getting this err

“errors”: [
“app_id not found. You may be missing a Content-Type: application/json header.”

But i add Content-Type: application/json header. and app_id

Can you share your app_id and device_token and rest api key?
i think you are supplying wrong app id in app_id in $fields array

I refer this link and my app id is 821e3c9a-aee4-45c7-9b1d-41bb67c9280b

run the code here i gave you.

@ravi_sojitra How can i add icon ? Kindly advice me

where do you want to add icon?

My app is received notification.default notification is bell.i need set to custom notification icon

How are you sending notification?
from PHP or onesignal dashboard?

I send notification using typescript with ionic 2.not PHP.

i need to see your code from where you are sending notification.

Here is my code

import { Component } from ‘@angular/core’;
import { NavController,Platform } from ‘ionic-angular’;
import { OneSignal } from ‘@ionic-native/onesignal’;
import { Http, Response, Headers, RequestOptions } from ‘@angular/http’;
selector: ‘page-home’,
templateUrl: ‘home.html’
export class HomePage {

constructor(public http: Http,public platform: Platform,private oneSignal: OneSignal,public navCtrl: NavController) {

let headers=new Headers();
headers.append('Content-Type','application/json; charset=utf-8');
headers.append('Authorization','Basic NDJhZDg0NWQtYjM0NS00YzUzLTgwNjktMDgyNThlMmUxNDYy')

let url = '';

let body = { 
	  app_id: "5d4fd62b-b9f8-4e41-9a89-7ea3b18af3de",
	  contents: {"en": "English Message"},
	  included_segments: ["All"]

let options = new RequestOptions({ 
	method: "POST",

}), body, options).subscribe(d2=>{

this.platform.ready().then(() => {
        console.log("USER ID");


  	this.oneSignal.handleNotificationReceived().subscribe((d) => {
 		// do something when notification is received
 		console.log("NOTIFICATION RECEIVED");

    this.oneSignal.handleNotificationOpened().subscribe((d1) => {
	  	// do something when a notification is opened
	  	console.log("NOTIFICATOIN OPENED");