Skip to content

Commit

Permalink
Add Console Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
coman3 committed Oct 28, 2016
1 parent 8a5ab57 commit eca21bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/android/FirebasePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,22 @@ public static void receiveNotification(Bundle bundle) {
PluginResult pluginresult = new PluginResult(PluginResult.Status.OK, json);
pluginresult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginresult);

}
}

public static void sendNotification(Bundle bundle) {
if(FirebasePlugin.notificationCallbackContext == null) {
final CallbackContext callbackContext = null;
if(FirebasePlugin.notificationCallbackContext == null || (callbackContext = FirebasePlugin.notificationCallbackContext.get()) == null) {
//No callback for notification, add to cache...
Log.d(TAG, "Send `CallbackContext` is null, adding notification to cache");
if(FirebasePlugin.pendingNotifications == null){
FirebasePlugin.pendingNotifications = new ArrayList<Bundle>();
}
}
pendingNotifications.add(bundle);
return;
}
final CallbackContext callbackContext = FirebasePlugin.notificationCallbackContext.get();

if (callbackContext != null && bundle != null) {
JSONObject json = new JSONObject();
Set<String> keys = bundle.keySet();
Expand Down Expand Up @@ -229,6 +232,7 @@ public static void sendToken(String token) {
@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Log.d(TAG, "FirebasePlugin NewIntent");
this.IsAppInForegound = true;
FirebasePlugin.sendNotification(intent.getExtras());

Expand Down Expand Up @@ -531,11 +535,13 @@ private static Map<String, Object> defaultsToMap(JSONObject object) throws JSONE
@Override
public void onPause(boolean multitasking) {
super.onPause(multitasking);
Log.d(TAG, "FirebasePlugin Pause");
this.IsAppInForegound = false;
}
@Override
public void onResume(boolean multitasking) {
super.onResume(multitasking);
Log.d(TAG, "FirebasePlugin Resume");
this.IsAppInForegound = true;
}

Expand All @@ -548,12 +554,14 @@ public void onStart() {
@Override
public void onStop() {
super.onStop();
Log.d(TAG, "FirebasePlugin Stop");
this.IsAppInForegound = false;
}

@Override
public void onDestroy() {
super.onDestroy();
Log.d(TAG, "FirebasePlugin Destroy");
this.IsAppInForegound = false;
}
}

0 comments on commit eca21bc

Please sign in to comment.