Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic Push: GCM project number not found in android application

I'm trying to use ionic.io to send push notification. Here is what I did :

  1. Create an app in GCM and enable GCM API.

enter image description here

  1. Create credentials and get the api key.

enter image description here

  1. Create an app in ionic.io dashboard
  2. Create a security profile and add the api key

enter image description here

  1. Create an api token in ionic.io dashboard

enter image description here

  1. My source code in app.js which generated by ionic start pushdemo

    .run(function($ionicPlatform) {
    
    $ionicPlatform.ready(function() {
    
    var push = new Ionic.Push({
      "debug": true
    });
    
    push.register(function(token) {
      alert(token.token);
      console.log("Device token:",token.token);
      push.saveToken(token);
    });
    

7.Add push plugin:

ionic plugin add phonegap-plugin-push --variable SENDER_ID="myproject_number"

I tried both with or without quotation mark around myproject_number. It's the project number in step 1.

8.Set the dev_push to false

9.Hook my app to ionic.io by ionic io init

10.Run ionic run android -lc

Found the following error message:

enter image description here

What's wrong with it? Can anybody help? Thanks.

like image 543
Bagusflyer Avatar asked Oct 31 '22 02:10

Bagusflyer


1 Answers

i had the same problem its generally because of proxy issue you are behind the proxy it means you are using internet by making request to the server ,so first you should use your own internet (in this case if you use WIFI then also it will work ) second aafter creating your project dirsctly make login from your cinsole to ionic io it will ake for email and password that will make your app live third

ionic plugin add phonegap-plugin-push --variable SENDER_ID="myproject_number"

use quotes for entering your project number.project number also called GCM number and your server key is the key you generated in same project means google console which enable you to use google services. and dont forget to add android platform

like image 171
Mahesh Nighut Avatar answered Nov 09 '22 12:11

Mahesh Nighut