use of com.onesignal.example.BlankActivity in project OneSignal-Android-SDK by OneSignal.
the class MainOneSignalClassRunner method testAndroidManifestConfigChangeFlags_orientationFlag.
/**
* Created a AndroidManifest with 2 activities, 1 with the orientation config and 1 without
* Using this AndroidManifest setup to test that a config setting is detectable
*/
@Test
public void testAndroidManifestConfigChangeFlags_orientationFlag() throws Exception {
OneSignalInit();
threadAndTaskWait();
// Set ActivityInfo.CONFIG_ORIENTATION configChanges flag
OneSignalShadowPackageManager.configChanges = ActivityInfo.CONFIG_ORIENTATION;
// Verify BlankActivity has orientation flag
boolean blankHasFlag = OneSignalPackagePrivateHelper.hasConfigChangeFlag(blankActivity, ActivityInfo.CONFIG_ORIENTATION);
assertTrue(blankHasFlag);
// Go to MainActivity
Intent mainIntent = new Intent(blankActivity, MainActivity.class);
Activity mainActivity = Robolectric.buildActivity(MainActivity.class).newIntent(mainIntent).create().get();
// Set no configChanges flags
OneSignalShadowPackageManager.configChanges = 0;
// Verify MainActivity has no orientation flag
boolean mainHasFlag = OneSignalPackagePrivateHelper.hasConfigChangeFlag(mainActivity, ActivityInfo.CONFIG_ORIENTATION);
assertFalse(mainHasFlag);
}
use of com.onesignal.example.BlankActivity in project OneSignal-Android-SDK by OneSignal.
the class NotificationOpenedActivityHMSIntegrationTestsRunner method osIAMPreview_showsPreview.
@Test
public void osIAMPreview_showsPreview() throws Exception {
ActivityController<BlankActivity> blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
Activity blankActivity = blankActivityController.get();
OneSignal.setAppId(ONESIGNAL_APP_ID);
OneSignal.initWithContext(blankActivity);
threadAndTaskWait();
blankActivityController.resume();
threadAndTaskWait();
Intent intent = helper_baseHMSOpenIntent().putExtra(PAYLOAD_OS_ROOT_CUSTOM, new JSONObject() {
{
put(PAYLOAD_OS_NOTIFICATION_ID, UUID.randomUUID().toString());
put(PUSH_ADDITIONAL_DATA_KEY, new JSONObject() {
{
put("os_in_app_message_preview_id", "UUID");
}
});
}
}.toString());
helper_startHMSOpenActivity(intent);
assertEquals("PGh0bWw+PC9odG1sPgoKPHNjcmlwdD4KICAgIHNldFBsYXllclRhZ3MobnVsbCk7Cjwvc2NyaXB0Pg==", ShadowOSWebView.lastData);
}
Aggregations