Browse Source

Android: Fixed a crash when juce_gui_extra is not present

The default main JuceActivity for JUCE apps calls appNewIntent() in its onNewIntent() implementation which is defined in juce_gui_extra. This commit moves the implementation into juce_gui_basics.
tags/2021-05-28
ed 4 years ago
parent
commit
a7667077f8
2 changed files with 21 additions and 21 deletions
  1. +21
    -0
      modules/juce_gui_basics/native/juce_android_Windowing.cpp
  2. +0
    -21
      modules/juce_gui_extra/native/juce_android_PushNotifications.cpp

+ 21
- 0
modules/juce_gui_basics/native/juce_android_Windowing.cpp View File

@@ -1667,4 +1667,25 @@ const int KeyPress::stopKey = extendedKeyModifier + 46;
const int KeyPress::fastForwardKey = extendedKeyModifier + 47;
const int KeyPress::rewindKey = extendedKeyModifier + 48;
//==============================================================================
struct JuceActivityNewIntentListener
{
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
CALLBACK (appNewIntent, "appNewIntent", "(Landroid/content/Intent;)V")
DECLARE_JNI_CLASS (JavaActivity, JUCE_PUSH_NOTIFICATIONS_ACTIVITY)
#undef JNI_CLASS_MEMBERS
static void JNICALL appNewIntent (JNIEnv*, jobject /*activity*/, jobject intentData)
{
#if JUCE_PUSH_NOTIFICATIONS && JUCE_MODULE_AVAILABLE_juce_gui_extra
juce_handleNotificationIntent (static_cast<void*> (intentData));
#else
juce::ignoreUnused (intentData);
#endif
}
};
JuceActivityNewIntentListener::JavaActivity_Class JuceActivityNewIntentListener::JavaActivity;
} // namespace juce

+ 0
- 21
modules/juce_gui_extra/native/juce_android_PushNotifications.cpp View File

@@ -1645,25 +1645,4 @@ bool juce_handleNotificationIntent (void* intent)
return false;
}
//==============================================================================
struct JuceActivityNewIntentListener
{
#define JNI_CLASS_MEMBERS(METHOD, STATICMETHOD, FIELD, STATICFIELD, CALLBACK) \
CALLBACK (appNewIntent, "appNewIntent", "(Landroid/content/Intent;)V")
DECLARE_JNI_CLASS (JavaActivity, JUCE_PUSH_NOTIFICATIONS_ACTIVITY)
#undef JNI_CLASS_MEMBERS
static void JNICALL appNewIntent (JNIEnv*, jobject /*activity*/, jobject intentData)
{
#if JUCE_PUSH_NOTIFICATIONS && JUCE_MODULE_AVAILABLE_juce_gui_extra
juce_handleNotificationIntent(static_cast<void*>(intentData));
#else
juce::ignoreUnused(intentData);
#endif
}
};
JuceActivityNewIntentListener::JavaActivity_Class JuceActivityNewIntentListener::JavaActivity;
} // namespace juce

Loading…
Cancel
Save