'flutter apk' now supports dynamically registered services.
Third-party libraries can now provide their own mojo services. They do so by adding a config.yaml file to their pub package which contains - a list of service names and java classes which handles that service's registration. - a list of pre-built .jar files to statically link with the app's shell when building the app.
This commit is contained in:
@@ -13,12 +13,12 @@
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<!-- Supposedly this permission prevents other apps from receiving our
|
||||
messages, but it doesn't seem to have any effect. -->
|
||||
<permission android:name="org.domokit.sky.shell.permission.C2D_MESSAGE"
|
||||
<permission android:name="org.domokit.fitness.permission.C2D_MESSAGE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="org.domokit.sky.shell.permission.C2D_MESSAGE" />
|
||||
<uses-permission android:name="org.domokit.fitness.permission.C2D_MESSAGE" />
|
||||
<!-- end for GCM -->
|
||||
|
||||
<application android:icon="@mipmap/ic_launcher" android:label="Fitness" android:name="org.domokit.fitness.FitnessApplication">
|
||||
<application android:icon="@mipmap/ic_launcher" android:label="Fitness" android:name="org.domokit.sky.shell.SkyApplication">
|
||||
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize" android:hardwareAccelerated="true" android:launchMode="singleTask" android:name="org.domokit.sky.shell.SkyActivity" android:theme="@android:style/Theme.Black.NoTitleBar">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
package org.domokit.fitness;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.chromium.mojo.system.Core;
|
||||
import org.chromium.mojo.system.MessagePipeHandle;
|
||||
import org.chromium.mojom.gcm.GcmService;
|
||||
import org.domokit.gcm.RegistrationIntentService;
|
||||
import org.domokit.sky.shell.ServiceFactory;
|
||||
import org.domokit.sky.shell.ServiceRegistry;
|
||||
import org.domokit.sky.shell.SkyApplication;
|
||||
|
||||
/**
|
||||
* Sky implementation of {@link android.app.Application}, managing application-level global
|
||||
* state and initializations.
|
||||
*/
|
||||
public class FitnessApplication extends SkyApplication {
|
||||
/**
|
||||
* Override this function to register more services.
|
||||
*/
|
||||
protected void onServiceRegistryAvailable(ServiceRegistry registry) {
|
||||
super.onServiceRegistryAvailable(registry);
|
||||
|
||||
registry.register(GcmService.MANAGER.getName(), new ServiceFactory() {
|
||||
@Override
|
||||
public void connectToService(Context context, Core core, MessagePipeHandle pipe) {
|
||||
GcmService.MANAGER.bind(
|
||||
new RegistrationIntentService.MojoService(context), pipe);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,3 +13,5 @@ material-design-icons:
|
||||
- name: navigation/close
|
||||
- name: navigation/menu
|
||||
- name: navigation/more_vert
|
||||
services:
|
||||
- gcm
|
||||
|
||||
@@ -175,5 +175,6 @@ initGcm() async {
|
||||
}
|
||||
|
||||
main() {
|
||||
initGcm();
|
||||
runApp(new FitnessApp());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user