Java Code Examples for android.app.Application

The following examples show how to use android.app.Application. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: firebase-android-sdk   Source File: PicassoModule.java    License: Apache License 2.0 8 votes vote down vote up
@Provides
@FirebaseAppScope
Picasso providesFiamController(
    Application application, PicassoErrorListener picassoErrorListener) {
  okhttp3.OkHttpClient client =
      new OkHttpClient.Builder()
          .addInterceptor(
              new Interceptor() {
                @Override
                public Response intercept(Chain chain) throws IOException {
                  return chain.proceed(
                      chain.request().newBuilder().addHeader("Accept", "image/*").build());
                }
              })
          .build();

  Picasso.Builder builder = new Picasso.Builder(application);
  builder.listener(picassoErrorListener).downloader(new OkHttp3Downloader(client));
  return builder.build();
}
 
Example 2
Source Project: GAlette   Source File: GAletteInstrumentationTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void weaveSendAppView() throws Exception {
    // Process classes.
    processClass("com.uphyca.galette.GAletteInstrumentationTest$TestClassForSendAppView");

    // Load instrumented classes.
    TestClassForSendAppView instrumentedObject = new TestClassForSendAppView();
    Application app = new Application();
    instrumentedObject.attach(app);

    // Invoke method.
    instrumentedObject.show();

    // Verify interactions.
    Method method = instrumentedObject.getClass().getDeclaredMethod("show", new Class[]{});
    verify(galette).sendAppView(eq(instrumentedObject), eq(app), eq(method), eq(new Object[]{}));
}
 
Example 3
Source Project: applivery-android-sdk   Source File: AppliverySdk.java    License: Apache License 2.0 6 votes vote down vote up
private static void initializeAppliveryConstants(Application app, String appToken,
    boolean isStoreRelease) {

  //region validate some requirements
  Context applicationContext = Validate.notNull(app, "Application").getApplicationContext();
  Validate.notNull(applicationContext, "applicationContext");
  Validate.hasInternetPermissions(applicationContext, false);
  //endregion

  AppliverySdk.appToken = appToken;
  AppliveryDataManager.INSTANCE.setAppToken(appToken);
  AppliverySdk.isStoreRelease = isStoreRelease;

  AppliverySdk.fileProviderAuthority = composeFileProviderAuthority(app);

  AppliverySdk.applicationContext = applicationContext;

  AppliverySdk.appliveryApiService = AppliveryApiServiceBuilder.getAppliveryApiInstance();
  AppliverySdk.activityLifecycle = new AppliveryActivityLifecycleCallbacks(applicationContext);
  AppliverySdk.permissionRequestManager =
      new AndroidPermissionCheckerImpl(AppliverySdk.activityLifecycle);
}
 
Example 4
Source Project: imsdk-android   Source File: QTalkSearchRNViewInstanceManager.java    License: MIT License 5 votes vote down vote up
public static boolean buildBundle(Application application){
    boolean is_ok = false;

    try {
        ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
                .setApplication(application)
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .addPackage(new SearchReactPackage())
                .addPackage( new SvgPackage())
                .addPackage(new RNI18nPackage())
                .setUseDeveloperSupport(CommonConfig.isDebug)
                .setInitialLifecycleState(LifecycleState.RESUMED);

        String localBundleFile = getLocalBundleFilePath(application);

        File file = new File(localBundleFile);
        if (file.exists()) {
            // load from cache
            builder.setJSBundleFile(localBundleFile);
        } else {
            // load from asset
            builder.setBundleAssetName(JS_BUNDLE_NAME);
        }

        mReactInstanceManager = builder.build();

        is_ok = true;
    }catch (Exception e){

    }

    return is_ok;
}
 
Example 5
Source Project: rxjava-RxLife   Source File: MyViewModel.java    License: Apache License 2.0 5 votes vote down vote up
public MyViewModel(@NonNull Application application) {
    super(application);
    Observable.interval(1, 1, TimeUnit.SECONDS)
        .as(RxLife.asOnMain(this))
        .subscribe(aLong -> {
            Log.e("LJX", "MyViewModel aLong=" + aLong);
        });
}
 
Example 6
Source Project: PeriscopeLayout   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 7
Source Project: ColorPicker   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 8
Source Project: LinkTextView   Source File: ApplicationTest.java    License: MIT License 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 9
Source Project: slf4android   Source File: NotifyDeveloperHandler.java    License: MIT License 4 votes vote down vote up
NotifyDeveloperHandler(Application context, Iterable<String> emailAddress, ActivityStateListener activityState) {
    this(context, emailAddress, LogLevel.ERROR, activityState);
}
 
Example 10
Source Project: deagle   Source File: Applications.java    License: Apache License 2.0 4 votes vote down vote up
public static Application getCurrent() {
    return CURRENT;
}
 
Example 11
Source Project: clip-image   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 12
Source Project: altex-image-downloader   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
  super(Application.class);
}
 
Example 13
Source Project: android-ActionSheet   Source File: ApplicationTest.java    License: MIT License 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 14
public ApplicationTest() {
    super(Application.class);
}
 
Example 15
Source Project: RxjavaRetrofitDemo-master   Source File: RxRetrofitApp.java    License: MIT License 4 votes vote down vote up
public static void init(Application app){
    setApplication(app);
    setDebug(true);
}
 
Example 16
Source Project: Kernel-Tuner   Source File: ApplicationTest.java    License: GNU General Public License v3.0 4 votes vote down vote up
public ApplicationTest()
{
    super(Application.class);
}
 
Example 17
public ApplicationTest() {
    super(Application.class);
}
 
Example 18
Source Project: ContentResolverDemo   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
  super(Application.class);
}
 
Example 19
Source Project: AndroidDemoProjects   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 20
Source Project: OverscrollScale   Source File: ApplicationTest.java    License: MIT License 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 21
Source Project: Barricade   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
  super(Application.class);
}
 
Example 22
Source Project: Clip-Stack   Source File: ApplicationTest.java    License: MIT License 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 23
Source Project: BouncyEditText   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 24
@AnyThread
@Override
protected void scheduleAlarm(@NonNull Application application, long delay) {
  setAlarm(application, delay, ViewOnceAlarm.class);
}
 
Example 25
Source Project: android-notification-log   Source File: ApplicationTest.java    License: MIT License 4 votes vote down vote up
public ApplicationTest() {
	super(Application.class);
}
 
Example 26
Source Project: twittererer   Source File: ApplicationModule.java    License: Apache License 2.0 4 votes vote down vote up
ApplicationModule(Application application) {
    this.application = application;
}
 
Example 27
Source Project: mini-hacks   Source File: Foreground.java    License: MIT License 4 votes vote down vote up
public static Foreground get(Application application){
    if (instance == null) {
        init(application);
    }
    return instance;
}
 
Example 28
Source Project: CreditCardView   Source File: ApplicationTest.java    License: MIT License 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}
 
Example 29
@SuppressWarnings("WeakerAccess")
public NavigationReactNativeHost(Application application) {
    super(application);
}
 
Example 30
Source Project: android-mvvm   Source File: ApplicationTest.java    License: Apache License 2.0 4 votes vote down vote up
public ApplicationTest() {
    super(Application.class);
}