2016-10-28 10 views
6

Ionic Hybrid App.like native appの通知バーにダウンロードの進行状況を表示したい。私はダウンロードファイルのためにcordova file transferプラグインを使用しています。Ionic Hybridアプリケーションの通知のダウンロード進捗を表示するにはどうすればいいですか?

これはIonic Appでは可能ですか?どうやってやるの?このfeature.Hereため

enter image description here

+0

これにはどんな解決策がありましたか? –

+0

まだ解決策がない場合は、イオンコミュニティに尋ねてください。 – sonu

+0

この同じ質問に対する回答を探しています。 htmlは 'cordova-plugin-background-mode'の' configure'メソッドの 'text'プロパティに与えられますか? – davejoem

答えて

0

使用cordovaToastプラグインが

HTML

<ion-view > 
    <div class="bar bar-subheader bar-positive" style="padding:0px;height: 8px;" > 
     <progress id="progressbar" max="100" value="{{ downloadProgress }}" class="progress"> </progress> 
    </div> 
    <ion-content> 
    </ion-content> 
</ion-view> 

CSS

PDFダウンロードの進行状況を示すための例です。このよう

.progress { 
    margin: 0 px; 
    height: 8 px; 
    background - color: #F1292B!important; 
    border - radius: 2 px; 
    box - shadow: 0 2 px 5 px rgba(0, 0, 0, 0.25) inset; 
} 

JS

if (window.cordova) { 
    var url = '{{base_url}}/pdf_download/' + id; 
    // Android 
    var targetPath = 'file:///storage/sdcard0/' + 'fpl_' + id + '.pdf'; 
    var trustHosts = true; 
    var options = {}; 
    $cordovaFileTransfer.download(url, targetPath, options, trustHosts) 
     .then(function(result) { 
      $cordovaToast 
       .show('File downloaded successfully..', 'short', 'center') 
       .then(function() { 
        // success 
       }, function() { 
        // error 
       }); 

      console.log(result); 
     }, function() { 
      var alertPopup = $ionicPopup.alert({ 
       title: 'No internet access', 
       buttons: [{ 
        text: 'OK', 
        type: 'button-assertive' 
       }] 
      }); 
      alertPopup.then(function() {}); 

     }, function(progress) { 
      var dnldpgs = progress.loaded.toString().substring(0, 2); 
      $scope.downloadProgress = parseInt(dnldpgs); 
     }); 
} 

あなたはどのdoubt.Pleaseが私know.Thanksを聞かせている場合。

+0

私はあなたのソリューションを試しましたが、それは違う方法で動作します。ポップアップのような画面に短いメッセージが表示されます。私はそれが私の質問(更新)の画像のように動作する必要があります。どうやってするか ? – sonu

+0

アプリ内以外の通知、バーを表示する方法はありますか?ちょうどネイティブアプリの通知が来るように –

関連する問題