# (Ionic 2 Push) Android device token registration issue

**URL:** <https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951>\
**Category:** ionic-v3\
**Created:** [May 12, 2017, 6:23am UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951 "2017-05-12T06:23:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esmith721](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Esmith721](https://forum.ionicframework.com/u/Esmith721)\
**Post date:** [May 12, 2017, 6:23am UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/1 "2017-05-12T06:23:23Z")

</div>

Hello All,

I’ve been attempting to get push notification working in my app and have been having trouble getting the device to register. Right now I have the dead basics from the documentation just to try and get it moving. I have added an alert inside of the then() after the device registers which it has never hit. I have also tried in VS 2017 browser simulator which also didn’t work, wasn’t expecting it to anyway.

I have tried testing the app both through side loading onto my phone and also through Ionic View both to no avail. I Firebase is setup and configured as is the app itself.

Any help or guidance would be appreciated!

Thanks!

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 12, 2017, 11:29am UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/2 "2017-05-12T11:29:42Z")

</div>

What plugins and libraries are you using to implement push in your app?  
What service are you trying to use to send push?

---

<div class="post-metadata">

**Author:** ![Esmith721](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Esmith721](https://forum.ionicframework.com/u/Esmith721)\
**Post date:** [May 12, 2017, 11:57am UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/3 "2017-05-12T11:57:42Z")

</div>

I am using ionic/cloud-angular Push service and trying to send a notification through the ionic dashboard. I did integrate the ionic Auth service thinking that had something to do with it and that was also didn’t help it.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 12, 2017, 1:58pm UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/5 "2017-05-12T13:58:58Z")

</div>

Show us some code please, then.

---

<div class="post-metadata">

**Author:** ![Esmith721](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Esmith721](https://forum.ionicframework.com/u/Esmith721)\
**Post date:** [May 12, 2017, 2:11pm UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/6 "2017-05-12T14:11:05Z")

</div>

Surely, This is my app.module.ts

```auto
import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
...
const cloudSettings: CloudSettings = {
    'core': {
        'app_id': 'aff7d862',
    },
    'push': {
        'sender_id': '1014472767909',
        'pluginConfig': {
            'ios': {
                'badge': true,
                'sound': true
            },
            'android': {
                'iconColor': '#343434'
            }
        }
    }
};

@NgModule({
    declarations: [
        MyApp,
        Login,
        Artists,
        Artist,
        Calendar,
        PopoverPage,
        AddapptmodalPage,
        ModifyapptmodalPage,
        Register,
        Chathub,
        Chat,
        SwipeVertical,
        FormatTime
    ],
    imports: [
        IonicModule.forRoot(MyApp),
        BrowserModule,
        FormsModule,
        ElasticModule,
        HttpModule,
        CalendarModule.forRoot(),
        CommonModule,
        CloudModule.forRoot(cloudSettings)
    ],
    bootstrap: [IonicApp],
    entryComponents: [
        MyApp,
        Login,
        Artists,
        Artist,
        Calendar,
        PopoverPage,
        AddapptmodalPage,
        ModifyapptmodalPage,
        Register,
        Chathub,
        Chat
    ],
    providers: [
        { provide: ErrorHandler, useClass: IonicErrorHandler },
        UserSingleton,
        SendBirdCtrl,
        FormatTime,
        AjaxMethods,
        { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }]
})

```

Then on the login page (which is the root of the app) there is this

```auto
import { Push, PushToken } from '@ionic/cloud-angular';
...
constructor(public navCtrl: NavController, private http: Http, private menu: MenuController, public currUser: UserSingleton,
        public modalCtrl: ModalController, public platform: Platform, public push: Push)
    {
        this.push.register().then((t: PushToken) =>
        {
            return this.push.saveToken(t);
        }).then((t: PushToken) =>
        {
            this.currUser.setValue("devicetoken", t.token);
            });

        this.push.rx.notification()
            .subscribe((msg) =>
            {
                alert(msg.title + ': ' + msg.text);
            });
    }

```

Right now it is a straight copy paste from [https://docs.ionic.io/services/push/](https://docs.ionic.io/services/push/) just so I can get it working then I’ll go off making it more complex, but not even the base code from the docs works.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [May 12, 2017, 2:16pm UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/7 "2017-05-12T14:16:20Z")

</div>

> [@Esmith721](#):
>
> Then on the login page (which is the root of the app) there is this

Try putting the push stuff in `app/app.component.ts` and there in the constructor and inside `platform.ready()`.

---

<div class="post-metadata">

**Author:** ![Esmith721](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Esmith721](https://forum.ionicframework.com/u/Esmith721)\
**Post date:** [May 12, 2017, 2:29pm UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/8 "2017-05-12T14:29:16Z")

</div>

alright, I’ll have to give it a try later tonight when I’m home but hopefully that’s it! I’ll let you know, thank you!

---

<div class="post-metadata">

**Author:** ![Esmith721](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Esmith721](https://forum.ionicframework.com/u/Esmith721)\
**Post date:** [May 13, 2017, 3:11pm UTC](https://forum.ionicframework.com/t/ionic-2-push-android-device-token-registration-issue/89951/9 "2017-05-13T15:11:53Z")

</div>

Well that still didn’t work, however, after scowering​ the internet tirelessly I can across OneSignal and am now using that for push notifications took about 20 minutes to setup and get working and it fully integrates with Ionic so at least it working now! Thanks for the help anyway Sujan!
