예제 #1
0
 static void publishInstallAsync(
     final Context context, final String applicationId, final Request.Callback callback) {
   // grab the application context ahead of time, since we will return to the caller immediately.
   final Context applicationContext = context.getApplicationContext();
   Settings.getExecutor()
       .execute(
           new Runnable() {
             @Override
             public void run() {
               final Response response =
                   Settings.publishInstallAndWaitForResponse(
                       applicationContext, applicationId, false);
               if (callback != null) {
                 // invoke the callback on the main thread.
                 Handler handler = new Handler(Looper.getMainLooper());
                 handler.post(
                     new Runnable() {
                       @Override
                       public void run() {
                         callback.onCompleted(response);
                       }
                     });
               }
             }
           });
 }