Forum Discussion
Embed PowerBI dashboard & report in Custom Mobile Apps
Hi eddywijaya,
I use webview (because I see there is no API besides Javascipt) to display the report in my mobile apps.
Are you using the PowerBI-JavaScript Embed For Mobile sample code to embed the report in your mobile application?
Could you share some sample code you're using which can help us reproduce the issue, so that we can better assist on it? :smileyhappy:
Regards
- eddywijaya8 years agoFrequent Visitor
Hi v-ljerr-msft, thank you for replying :smileyvery-happy:
I'm developing this for iOS application.
In order to display the Power BI report in iOS device : I put the html file in the asset (xcode project) and then load it into a WebView. I followed the microsoft's live demo, so first I prepare a <div> container like this :
<div id="reportContainer"></div>
and then call the Power BI to embed in my container with the javascript SDK
var embedUrl = "https://app.powerbi.com/dashboardEmbed?dashboardId=e982axxx-5xxx-44b1-ae35-66axxxxxxxxx"; var config = { type: 'dashboard', accessToken: accessToken, embedUrl: embedUrl }; var dashboardContainer = document.getElementById('dashboardContainer'); var dashboard = powerbi.embed(dashboardContainer, config);Then, in the iOS application I load that html file in a webview (with WKWebView) :
@property (strong, nonatomic) IBOutlet WKWebView *dashboardWV; NSString *filePath=[[NSBundle mainBundle]pathForResource:@"BI" ofType:@"html" inDirectory:@"powerbi"]; NSURL *url = [NSURL fileURLWithPath: filePath]; NSURLRequest* request = [NSURLRequest requestWithURL:url]; [dashboardWV loadRequest:request];
Are you using the PowerBI-JavaScript Embed For Mobile sample code to embed the report in your mobile application?
Not yet, but I think it will only change the layout of the report. We have no problem with the layout displayed since we are only using iPad / Tablet for our application. But I'll try that, thanks for the information.