Page 35 - MSDN Magazine, December 15, 2017
P. 35

be surprised during development if you uninstall and reinstall on the same device and see the count of active users increase. App updates continue using the same identifier.) Figure 5 shows the Analytics page for the fictitious Contoso Air app.
The App Center SDK is modular. To enable gathering and sending analytics data, add the module in the dependencies.
def appCenterSdkVersion = '1.0.0'
compile "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersi on}"
Override the onCreate method and start the App Center mod- ules you’re using:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanseState);
AppCenter.start(getApplication(), appSecret:”your-app-key”, Analytics. class, Crash.class);
}
App Center shows the distribution of sessions, devices, countries, languages and app version. It also provides the distribution of OS version. For Android, the API level is shown. Countries are iden- tified by the carrier country provided by the platform. Language is based on the user’s system settings. You can filter by version and time range. App Center shows distributions for 7, 30, 60 and 90 days, along with trends against the previous time period. The API allows you to query for custom date ranges up to 90 days.
App Center is mission control for your apps.
A session is started when the user first launches the app. When an app is resumed, if it was in the background for less than 20 seconds, it isn’t considered a new session. This avoids incorrectly treating every short interruption as the end of a session. The ses- sion duration is calculated by looking at all App Center telemetry coming from the app. They’re grouped into duration “buckets” to give you a sense of how long users are interacting with the app. If you don’t add any custom events for tracking, the sessions will all be in the 0-10 second bucket unless the app crashes.
Track Events. You can instrument your app with custom events to understand exactly how the app is being used. App Center will count up to 200 unique event names per day. Event names are lim- ited to 256 characters in length:
Analytics.trackEvent("Login");
The event analytics provide details about the count of the event, the number of users with the event, the count per user and the count per session. It also provides the changes in counts over time. You can also associate name/value properties with an event. App Center analytics will provide the distribution of the top-10 values for each property name:
Map<String, String> properties = new HashMap(); properties.put("category", "image"); properties.put("filetype", "png"); Analytics.trackEvent("File upload", properties);
Export Data. App Center analytics will keep 90 days of data. If you want to do analytics over longer periods of time or do ad hoc and custom query processing, you can configure continuous msdnmagazine.com
App Center Release Automation
App Center can automate store releases. After an Android app has been published to the Google Play store for the first time, subsequent releases can be initiated from App Center. Publishing to Google Play requires a developer account. Register at bit.ly/2hx6pp4. Use the Google Play Console to first publish the app and to create an API project. You must have an API project for calling the publishing APIs.
App Center uses server-to-server authentication to publish to the store. On the API Access page of the Google Play Console, create a service account. Select Project Owner as the role with a new private JSON key type. The JSON file will be downloaded by the browser. Keep this file secure.
After the service count is created and the JSON private key generated, click Grant Access. The JSON key can now be used to authenticate as the service account with the project owner role.
In App Center, the Stores feature is in the Distribute area. When you create a connection to the Google Play store, App Center
will prompt you to upload the JSON key that was generated for the service account and connect to the store. The connection will show alpha, beta and production tracks for publishing.
The next time you’re ready to publish through Google Play, navigate to the Stores area of App Center, and select the destination track. App Center will soon support the option to select a package built in App Center instead of uploading it. Production track releases require the application package version be greater than the currently published version. Also note that store releases must be release builds, and signed with a key store, as well as zipaligned.
The release initially shows a status of submitted. App Center delivers the package to Google Play and the status is updated to “published.” It can take up to 24 hours before the package is released and available for download.
export of the analytics data from App Center. The two options for export are Azure App Insights and Azure Blob Storage. When you setup an export to Azure App Insights, a schema for App Center data is configured. If you were previously using HockeyApp with App Insights, your existing queries can be reused. Exporting to Azure blob storage provides additional flexibility to import your data to an on-premises data warehouse or into other Big Data processing systems in Azure.
App Center is mission control for your apps. It brings together the key services you need to build better apps faster. You can have continuous integration for your app that includes running tests on real devices. You can distribute to beta users and leverage crash handling to identify and fix critical problems before releasing to the public. And you can instrument your app to get a deep under- standing of how the app is used to better engage with the users.n
Matt Gibbs works as a group engineering manager at Microsoft, delivering services and SDKs for mobile app developers. In previous years, he worked on Azure SDKs, Xbox Live Services, ASP.NET, Windows Forms, IIS and “classic” Active Server Pages.
thanks to the following Microsoft technical experts for reviewing this article: Scott Densmore and Thomas Dohmke
Dec. 15, 2017 / Connect(); Special Issue 31




































































   33   34   35   36   37