Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getToken not working in ios #649

Open
fifl-official opened this issue Mar 26, 2021 · 1 comment
Open

getToken not working in ios #649

fifl-official opened this issue Mar 26, 2021 · 1 comment

Comments

@fifl-official
Copy link

Hi
I have issue when use getToken function in ios platform.
My app's corvova version is 10.0.0 and cordova-ios version is 5.0.0.
And app was made by Vue.js.

Logic is simple..

  1. App Login -> 2. launch getToken function -> 3. get new fcm Token

In step2 has a problem when the platform is ios.
This problem occured 8 time when I tried 10 times.

How can i solve this problem?

@alexandrox92
Copy link

Could you pass me the code fragment that you use to obtain the token in android?

this is my index.js and i can't get the token.

var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},

// deviceready Event Handler
onDeviceReady: function() {
    this.receivedEvent('deviceready');
    this.pushNotification();
},

// Update DOM on a Received Event
receivedEvent: function(id) {
    var parentElement = document.getElementById(id);
    var listeningElement = parentElement.querySelector('.listening');
    var receivedElement = parentElement.querySelector('.received');
    listeningElement.setAttribute('style', 'display:none;');
    receivedElement.setAttribute('style', 'display:block;');
    console.log('Received Event: ' + id);
},
pushNotification: function(){

/***********************************************************************************************/

  FCMPluginNG.onNotification(function(data)
  {
    if(data.wasTapped){
      alert(JSON.stringify(data));
    }else{
      alert(JSON.stringify(data));
    }
  });

/***********************************************************************************************/

}

};

app.initialize();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants