Skip to content

Commit

Permalink
Merge pull request #359 from Backendless/oleg.vyalyh/18043/FCM_when_a…
Browse files Browse the repository at this point in the history
…pp_kill

BKNDLSS-18043 [SUPPORT] NullPointerException in BackendlessFCMService…
  • Loading branch information
ksv510 authored Jan 29, 2019
2 parents 6fd5871 + fe610de commit 509e2fd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/com/backendless/Backendless.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ private static boolean isAndroidEnvironment()
Log.removeLogger( ILoggingConstants.DEFAULT_LOGGER );
prefs = BackendlessPrefsFactory.create( isAndroid );
if( isAndroid )
{
prefs.onCreate( ContextHandler.getAppContext() );
Media = com.backendless.Media.getInstance();
}

AmfV3Formatter.AddTypeWriter( QueryOptions.class, new ITypeWriter()
{
Expand All @@ -120,6 +123,17 @@ public boolean isReferenceableType()
return false;
}
} );

try
{
if( !initialized && prefs.getApplicationId() != null && prefs.getApiKey() != null )
Backendless.initApplicationFromProperties( ContextHandler.getAppContext() );
}
catch( IllegalStateException e )
{
if( !ExceptionMessage.NOT_INITIALIZED.equals( e.getMessage() ) )
throw e;
}
}

public static boolean isAndroid()
Expand Down Expand Up @@ -202,7 +216,7 @@ public static void initApp( Object context, final String applicationId, final St
Class realmObjectClass = Class.forName( "io.realm.RealmObject" );
BackendlessSerializer.addSerializer( realmObjectClass, new RealmSerializer() );
}
catch( Throwable t )
catch( Throwable ignore )
{

}
Expand Down

0 comments on commit 509e2fd

Please # to comment.