3

나는 cordova 프로젝트를 만들고 Azure 모바일 앱 + 알림 허브 서비스를 사용하고 있습니다. 코르도바 프로젝트에서 , 나는 추가 "코르도바 - 플러그인-MS를-푸른-모바일 애플 리케이션"와 "폰갭 - 플러그인 푸시"플러그인하지만 프로젝트를 실행했을 때 오류 얻을 :cordova azure 모바일 앱 및 알림 허브 서비스

Failed to load resource: the server responded with a status of 404 - Cannot GET /push/installations/xxxxx(it's a guid string)

설정 정보를 :

phonegap-plugin-push : version="1.7.2" cordova-plugin-ms-azure-mobile-apps : version="2.0.0-beta5" dev tool : visual studio 2015

오류 메시지 그림 : enter image description here

var azureClient = new WindowsAzure.MobileServiceClient('http://xxxxxx.azurewebsites.net'); 
 

 
     //PushNotification. 
 
     var push = PushNotification.init({ 
 
      android: { 
 
       senderID: "xxx895803xxxx" 
 
      }, 
 
      ios: { 
 
       alert: "true", 
 
       badge: "true", 
 
       sound: "true", 
 
      }, 
 
      windows: {} 
 
     }); 
 

 
     push.on('registration', function (data) { 
 
      azureClient.push.register('gcm', data.registrationId); 
 
     }); 
 

 
     push.on('notification', function (data, d2) { 
 
      alert('Push Received: ' + data.message); 
 
     });

WindowsAzure.MobileServiceClient이 직접 관련이있을 것 같지 않습니다

function executeRequest(client, method, pushChannel, content, installationId, callback) { 
 
    Validate.isString(pushChannel, 'pushChannel'); 
 
    Validate.notNullOrEmpty(pushChannel, 'pushChannel'); 
 

 
    var headers = { 'If-Modified-Since': 'Mon, 27 Mar 1972 00:00:00 GMT' }; 
 
    headers[constants.apiVersionHeaderName] = constants.apiVersion; 
 

 
    client._request(
 
     method, 
 
     'push/installations/' + encodeURIComponent(installationId), 
 
     content, 
 
     null, 
 
     headers, 
 
     callback 
 
    ); 
 
}

답변

0

푸른 모바일 애플 리케이션을 연결하고 azureClient.push.register 기능 MobileServices.Cordova.js (cordova-plugin-ms-azure-mobile-apps 플러그인)에서 executeRequest 함수를 호출하는 cordova-plugin-ms-azure-mobile-apps 플러그인입니다 모바일 앱 또는 알림 허브가 아니라 Cordova 구성 문제입니다.

하나는 아래 링크 중 하나 just search을 시도해보십시오

또한, 방법은 Add push notifications to your Apache Cordova app에에 대한 단계별 튜토리얼이있다. 당신이하고있는 것이이 튜토리얼에서 제안한 것과 유사한지를 확인하는데 도움이 될 수 있습니다.

+0

감사합니다. 그러나 모바일 응용 프로그램 및 알림 허브에만 해당되며 코드 화이트 허용 목록 구성을 확인한 경우 오류가 있습니다. – Ian

+0

"프로젝트를 실행할 때"가 정확히 무엇을 의미하는지 설명해 주시겠습니까? 어떤 시점에서 오류 메시지가 나타 납니까? 빌드 또는 런타임? 후자의 경우, 실패한 코드 묶음을 붙여 넣을 수 있습니까? –

+0

안녕하세요, 런타임에 오류를 가져오고 (디버그 모드) 프로젝트를 장치에 게시하고 에뮬레이터를 사용하십시오. – Ian

0

build.gradle 파일에 다음 종속성을 추가하십시오. 그리고 다시 지어 라.

dependencies { 
     classpath 'com.android.tools.build:gradle:1.5.0' 
     classpath 'com.android.tools.build:gradle:2.1.0' 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
관련 문제