Skip to content

Commit 32e918b

Browse files
committed
fixed error messages
1 parent b88f710 commit 32e918b

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

src/com/backendless/Messaging.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -254,39 +254,47 @@ private synchronized void registerDeviceGCMSync( Context context, String GCMSend
254254
}
255255

256256
/**
257-
* For FireBase messaging only.
257+
* For Firebase Cloud Messaging only
258258
*/
259259
public void registerDevice()
260260
{
261261
registerDevice( Collections.singletonList( DEFAULT_CHANNEL_NAME ) );
262262
}
263263

264264
/**
265-
* For FireBase messaging only.
265+
* For Firebase Cloud Messaging only
266266
*/
267267
public void registerDevice( List<String> channels )
268268
{
269269
registerDevice( channels, (Date) null );
270270
}
271271

272272
/**
273-
* For FireBase messaging only.
273+
* For Firebase Cloud Messaging only
274274
*/
275275
public void registerDevice( List<String> channels, Date expiration )
276276
{
277277
registerDevice( channels, expiration, (AsyncCallback<DeviceRegistrationResult>) null );
278278
}
279279

280280
/**
281-
* For FireBase messaging only.
281+
* For Firebase Cloud Messaging only
282+
*/
283+
public void registerDevice( AsyncCallback<DeviceRegistrationResult> callback )
284+
{
285+
registerDevice( Collections.singletonList( DEFAULT_CHANNEL_NAME ), (Date) null, callback );
286+
}
287+
288+
/**
289+
* For Firebase Cloud Messaging only
282290
*/
283291
public void registerDevice( List<String> channels, AsyncCallback<DeviceRegistrationResult> callback )
284292
{
285293
registerDevice( channels, (Date) null, callback );
286294
}
287295

288296
/**
289-
* For FireBase messaging only.
297+
* For Firebase Cloud Messaging only
290298
*/
291299
public void registerDevice( List<String> channels, Date expiration, AsyncCallback<DeviceRegistrationResult> callback )
292300
{
@@ -295,21 +303,21 @@ public void registerDevice( List<String> channels, Date expiration, AsyncCallbac
295303

296304
if( channels == null || channels.isEmpty() ||
297305
(channels.size() == 1 && (channels.get( 0 ) == null || channels.get( 0 ).isEmpty())) )
298-
{
299306
channels = Collections.singletonList( DEFAULT_CHANNEL_NAME );
300-
}
301307

302308
for( String channel : channels )
303309
checkChannelName( channel );
304310

305311
long expirationMs = 0;
312+
306313
if( expiration != null)
307314
{
308315
if( expiration.before( Calendar.getInstance().getTime() ) )
309316
throw new IllegalArgumentException( ExceptionMessage.WRONG_EXPIRATION_DATE );
310317
else
311318
expirationMs = expiration.getTime();
312319
}
320+
313321
FCMRegistration.registerDevice( ContextHandler.getAppContext(), channels, expirationMs, callback );
314322
}
315323

src/com/backendless/push/BackendlessPushService.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ public static boolean isFCM( Context appContext )
486486
}
487487
catch( ClassNotFoundException e )
488488
{
489-
Log.i( TAG, "Class FirebaseMessagingService not found. GCM will be used." );
489+
Log.e( TAG, "Class FirebaseMessagingService cannot be found. FCM is not properly configured in your application." );
490490
return isFCM = false;
491491
}
492492

@@ -507,8 +507,9 @@ public static boolean isFCM( Context appContext )
507507
}
508508
catch( ClassNotFoundException e )
509509
{
510-
Log.e( TAG, "Can not load declared service class.", e );
511-
throw new IllegalStateException( "Can not load declared service class.", e );
510+
String error = "Unable to load com.backendless.push.BackendlessFCMService";
511+
Log.e( TAG, error, e );
512+
throw new IllegalStateException( error, e );
512513
}
513514

514515
for( ServiceInfo srvInfo : services )
@@ -524,13 +525,13 @@ public static boolean isFCM( Context appContext )
524525
}
525526
catch( ClassNotFoundException e )
526527
{
527-
Log.w( TAG, "You have declared class in AndroidManifest.xml that is not present in your app.", e );
528+
Log.e( TAG, "An FCM service class is registered in AndroidManifest.xml but it cannot be found in your app. The class name is " + srvInfo.name, e );
528529
}
529530
}
530531

531532
if( !flag )
532533
{
533-
Log.i( TAG, "Class FirebaseMessagingService not found. GCM will be used." );
534+
Log.i( TAG, "Class FirebaseMessagingService cannot found. FCM is not properly configured in your app." );
534535
return isFCM = false;
535536
}
536537
}
@@ -546,7 +547,7 @@ public static boolean isFCM( Context appContext )
546547
List<ResolveInfo> srvIntentFilters = packageManager.queryIntentServices( intent, PackageManager.GET_INTENT_FILTERS );
547548

548549
if( srvIntentFilters.isEmpty() )
549-
throw new IllegalStateException( "Missed intent-filter action " + action );
550+
throw new IllegalStateException( "Missing the intent-filter action: " + action );
550551

551552
return isFCM = true;
552553
}

0 commit comments

Comments
 (0)