MAP API KEY MISSING

17 posts, 0 answers
  1. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 09 Apr 2014 Link to this post

    Hi All,

    I am just trying to configure https://github.com/telerik/backend-services-push-hybrid

    But it always says that Missing API key! It appears that you have not filled in your Everlive API key. Please go to scripts/app/main.js and enter your Everlive API key at the beginning of the file.

    I am changing API and google project on below stuffs but still it says above message. 

    Could you please let us know how it will work?

    Also how i can send test message once my device got registered. please let me know?

    //This is your Everlive API key.
    var everliveApiKey = 'EVERLIVE_API_KEY';

    var androidProjectNumber = 'GOOGLE_PROJECT_NUMBER';

    and on here

    var onDeviceReady = function() {
            if (!everliveApiKey || everliveApiKey == 'EVERLIVE_API_KEY') {
                $("#messageParagraph").html("Missing API key!<br /><br />It appears that you have not filled in your Everlive API key.<br/><br/>Please go to scripts/app/main.js and enter your Everlive API key at the beginning of the file.");
                $("#initializeButton").hide();
            } else if ((!androidProjectNumber || androidProjectNumber == 'GOOGLE_PROJECT_NUMBER') && device.platform.toLowerCase() == "android") {
                $("#messageParagraph").html("Missing Android Project Number!<br /><br />It appears that you have not filled in your Android project number. It is required for push notifications on Android.<br/><br/>Please go to scripts/app/main.js and enter your Android project number at the beginning of the file.");
                $("#initializeButton").hide();
            }


    Thanks,

    Vivek.
        };






  2. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 11 Apr 2014 Link to this post

    Hi Vivek,

    Actually, there is a more up-to-date official version of the push notifications sample. We'd recommend that you go through the introductory page with in-depth explanations on how to clone it and run the sample app.

    In regard, to the code snippet - please, make sure to enter the API key and the Google Project Number as values of the respective variables only. There is no need to modify anything in the if clause check.

    Please, let us know if this works for you.

    Regards,
    Anton Dobrev
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  3. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 11 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    Thanks for your reply.

    I cloned the project and I changed bellow.

    //This is your Telerik BackEnd Services API key.
    var baasApiKey = '1vsvd6PgthOdBFD3';

    //This is the scheme (http or https) to use for accessing Telerik BackEnd Services.
    var baasScheme = 'http';

    //This is your Android project number. It is required by Google in order to enable push notifications for your app. You do not need it for iPhone.
    var androidProjectNumber = '45553197924';

    //Set this to true in order to test push notifications in the emulator. Note, that you will not be able to actually receive 
    //push notifications because we will generate fake push tokens. But you will be able to test your other push-related functionality without getting errors.
    var emulatorMode = true;

    var app = (function () {
        'use strict';
        
        window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
            alert(url + ":" + lineNumber + ": " + errorMsg);
            return false;
        }
        
        var onDeviceReady = function() {
            if (!baasApiKey || baasApiKey == '1vsvd6PgthOdBFD3') {
                $("#messageParagraph").html("Missing API key!<br /><br />It appears that you have not filled in your Telerik BackEnd Services API key.<br/><br/>Please go to scripts/app/main.js and enter your Telerik BackEnd Services API key at the beginning of the file.");
                $("#initializeButton").hide();
            } else if ((!androidProjectNumber || androidProjectNumber == '45553197924') && device.platform.toLowerCase() == "android") {
                $("#messageParagraph").html("Missing Android Project Number!<br /><br />It appears that you have not filled in your Android project number. It is required for push notifications on Android.<br/><br/>Please go to scripts/app/main.js and enter your Android project number at the beginning of the file.");
                $("#initializeButton").hide();
            } 
        }; I am using backend key also, I confirm that project number of google is also good. please let know what I am doing wrong?





  4. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 11 Apr 2014 in reply to Vivek Kumar Link to this post

    If you see above I am changing the key only in project and apart from this entire project is untouched.

    Please let me know what I am doing wrong.

    I will wait for your reply on these.



  5. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 11 Apr 2014 Link to this post

    Still it say missing API.

    I think somewhere project is not working. could you please check this?
  6. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 14 Apr 2014 Link to this post

    Hello Vivek Kumar,

    Below, let's go through the code of the sample app where the control logic of the sample is defined.

    1. These are the necessary variable assignments:
    //This is your Telerik BackEnd Services API key.
    var baasApiKey = '1vsvd6PgthOdBFD3';
     
    //This is the scheme (http or https) to use for accessing Telerik BackEnd Services.
    var baasScheme = 'http';
     
    //This is your Android project number. It is required by Google in order to enable push notifications for your app. You do not need it for iPhone.
    var androidProjectNumber = '45553197924';

    2. At line 12 of the script - set this variable to true only if you are running the app in the simulator. When deploying it to a device, set it to false:
    var emulatorMode = false;

    The developer is expected to assign manually only the aforementioned fields.

    3. Continuing on the script - in the onDeviceReady function (starting from line 22) is registered a simple check with two if clauses. Do not enter the actual api key and project number there. This checks verify if the variables exist and if they are set with a values, that are different from the sample defaults. In order to test the sample, do not modify the code snippet and leave it as it is by default:

    var onDeviceReady = function() {
            if (!baasApiKey || baasApiKey == 'BAAS_API_KEY') {
                $("#messageParagraph").html("Missing API key!<br /><br />It appears that you have not filled in your Telerik BackEnd Services API key.<br/><br/>Please go to scripts/app/main.js and enter your Telerik BackEnd Services API key at the beginning of the file.");
                $("#initializeButton").hide();
            } else if ((!androidProjectNumber || androidProjectNumber == 'GOOGLE_PROJECT_NUMBER') && device.platform.toLowerCase() == "android") {
                $("#messageParagraph").html("Missing Android Project Number!<br /><br />It appears that you have not filled in your Android project number. It is required for push notifications on Android.<br/><br/>Please go to scripts/app/main.js and enter your Android project number at the beginning of the file.");
                $("#initializeButton").hide();
            }
        };

    Let us know, if this works for you.

    Regards,
    Anton Dobrev
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  7. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 15 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    Thanks for reply.

    Now I am able to register the device on telerik back end. I can see my registered device on telerik back end under device section.

    Now when I say Push "Add a push notification" from telerik backend and I am trying to send push notification message to the device.

    The device is not getting any push notification, Please let me know what I am doing wrong?







  8. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 15 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    Please see Telerik Backend screenshot as an attachment.

    the device is coming under device section but when I say push it says  device "0" sent ?

    Please let me know If am doing anything wrong.

    Thanks,

    Vivek.
  9. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 16 Apr 2014 Link to this post

    Hello Vivek,

    These column takes a while to aggregate, it is not updated immediately.

    However, this is connected to one other thing, noticeable in the device.png screenshot. The device is registered with a token value of "fake_push_token" (i.e. this is the simulator). In order to test the whole interaction of sending and receiving of push notifications, please, set the var emulatorMode = false;  in the main.js of the app and deploy it to your device. Then, you can sent notifications from the portal and receive them on the device. Notifications cannot be received in the simulator.

    Please, let us know if you have questions.

    Regards,
    Anton Dobrev
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  10. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 16 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    emulatorMode = false is also not sending push notification.

    fake_push is always there if you set it to false also.

    I am sending you a QR code please check it.

    Is Push sending can take time to reach on phone? 

    I just used application craft I did the same itys working fine and it quick also.

    Could you please let me know what to do now?
    Thanks,

    Vivek.
  11. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 16 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    It was my fault now I am getting push on my android phone.

    But now next thing -->  push to redirect to some page lets say that I got a push on my phone now I clicked on push notification then it should redirect me to the  one page not home where I will show some contents.

    Is this is possible in android and IPhone both?

  12. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 16 Apr 2014 in reply to Vivek Kumar Link to this post

    Hi Anton,

    Please let me know ASAP.

    Thanks,

    Vivek
  13. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 17 Apr 2014 Link to this post

    Hi,

    You can register your custom code in the respective handlers in the client-side code:

     

    var onAndroidPushReceived = function (args) {
        // your custom implementation
        //alert('Android notification received: ' + JSON.stringify(args));
    };
     
    var onIosPushReceived = function (args) {
      // your custom implementation
      //  alert('iOS notification received: ' + JSON.stringify(args));
    };

    This methods will be called when the app is in the background and the user taps the notification message in the banner, bar, etc. If the app is currently running in the foreground, these functions will be called at the moment the notification is received.

    Regards,

     

    Anton Dobrev
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  14. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 17 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    Any example?

    Thanks,

    Vivek
  15. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 18 Apr 2014 Link to this post

    Hi,

    We do not have a dedicated sample for this, but basically, here are two snippets that will cover a basic scenario:

    1. Using the in-app browser:
    window.open('www.myserver.com');

    2. Using the Kendo Mobile app instance (var app = new kendo.mobile.Application();)  to load a remote view of your application, given that the app is built upon the Kendo mobile template:

    - if the remote view is in a dedicated 'views' folder:
    app.navigate('views/my-custom-view-here.html');

    -
    if the view is in the current page:
    app.navigate("#custom-view");

    Note: Add these lines of code, in the respective functions that will be invoked when a remote push message is received, onAndroidPushReceived and onIosPushReceived, respectively.

    Please, let me know if you have questions.

    Regards,

    Anton Dobrev
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  16. Vivek Kumar
    Vivek Kumar avatar
    15 posts
    Member since:
    May 2010

    Posted 18 Apr 2014 in reply to Anton Dobrev Link to this post

    Hi Anton,

    Thanks for your reply.

     I have two more question for you. If you have examples for both please let me know.

     1. Is badge counter can be implemented in Android also?

     2.  I want to give bubble count inside my app is it possbe to have? see  here . if you see inbox it has bubble count same like that.

  17. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 22 Apr 2014 Link to this post

    Hello,

    As to your questions:
    • Android devices display the messages count for an app. This value is set in the msgcnt field of the notification payload. It is not displayed as a badge over the app's icon, but as number next to the notification in the notification bar. Sample payload:
      "Android": {
              "data": {
                  "title": "My-App-Title-Here",
                  "message": "Push message from my app",
                  "customData": "Custom data for Android",
                    "msgcnt": 1
              }
      // another settings
    • I am guessing that this is a CSS related question. You could implement similar styling in your app as in the demo.

    Regards,
    Anton Dobrev
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
Back to Top