Huawei The splash ad is not closing - huawei-mobile-services

I have integrated huawei ads kits in application. i have implemented as per the documentation. The app is not being open as it stucks in splash screen.
How to close the splash ad?

We request you to please re-check the implementation of onAdDismissed() function of SplashAdLoadListener.
You need to navigate to next activity from the function, onAdDismissed() as shown below:
SplashView.SplashAdLoadListener splashAdLoadListener = new SplashView.SplashAdLoadListener() {
#Override
public void onAdLoaded() {
// Called when an ad is loaded successfully.
...
}
#Override
public void onAdFailedToLoad(int errorCode) {
// Called when an ad fails to be loaded. The app home screen is then displayed.
jump();
}
#Override
public void onAdDismissed() {
// Called when the display of an ad is complete. The app home screen is then displayed.
jump();
}
};

Related

Running code when splash screen is shown in an MAUI application

I want to run some code while the splash screen is shown in a MAUI application. The official documentation has only instruction about the image (so far).
I assume I need to do a solution for each platform. I have tried to follow the instruction for Xamarin on Android and getting pretty close. I have created this Activity:
[Activity(Theme = "#style/MyTheme.Splash", MainLauncher = true, NoHistory = true)]
public class SplashActivity : MauiAppCompatActivity
{
static readonly string TAG = "X:" + typeof(SplashActivity).Name;
public override void OnCreate(Bundle savedInstanceState, PersistableBundle persistentState)
{
base.OnCreate(savedInstanceState, persistentState);
Log.Debug(TAG, "SplashActivity.OnCreate");
}
// Launches the startup task
protected override void OnResume()
{
base.OnResume();
Task startupWork = new Task(() => { SimulateStartup(); });
startupWork.Start();
}
// Simulates background work that happens behind the splash screen
async void SimulateStartup ()
{
Log.Debug(TAG, "Performing some startup work that takes a bit of time.");
await Task.Delay (3000); // Simulate a bit of startup work.
Log.Debug(TAG, "Startup work is finished - starting MainActivity.");
//StartActivity(new Intent(MainApplication.Context, typeof (MainActivity)));
}
}
My problem is that when SimulateStartup starts to run the UI is launching, despite MainActivity is never created.
In then end of MauiProgram.CreateMauiApp() I have added this:
var app = builder.Build();
Task.Run(async () =>
{
await Task.Delay(4000);
var bootstrap = app.Services.GetRequiredService<MyBootstrapService>();
await bootstrap.SetupAsync();
}).Wait();
return app;
It works on Android. In Windows there are no splash screen, so user will se nothing until the bootstrapping is ready.

How to prevent gwt app to go to login page after page refresh?

I have a gwt app with a login page and a main page. After login app goes to main page. What i want is if i refresh the page to stay in main page and not going to login page. I have read many things and i tried History Mechanish but no result. Here is my code:
#Override
public void onSuccess(Login result) {
if (result.getLoginCount() == 1) {
final VerticalPanel userPanel = new VerticalPanel();
Anchor logout = new Anchor("logout");
logout.addStyleName("user");
logout.addClickHandler(new ClickHandler() {
#Override
public void onClick(ClickEvent event) {
loginPanel.setVisible(true);
tablePanel.setVisible(false);
addPanel.setVisible(false);
userPanel.setVisible(false);
}
});
Label user = new Label("Hi " + usernameBox.getText());
userPanel.add(user);
user.addStyleName("user");
userPanel.add(logout);
userPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
userPanel.setVisible(true);
usernameBox.setText("");
passwordBox.setText("");
RootPanel.get("user").add(userPanel);
loginPanel.setVisible(false);
tablePanel.setVisible(true);
addPanel.setVisible(true);
History.newItem("main");
History.addValueChangeHandler(new ValueChangeHandler<String>() {
#Override
public void onValueChange(ValueChangeEvent<String> event) {
if(History.getToken().equals("main")){
loginPanel.setVisible(false);
tablePanel.setVisible(true);
addPanel.setVisible(true);
}
}
});
}
i also tried:
String historyToken = event.getValue();
if(historyToken.substring(0 , 4).equals("main")){
loginPanel.setVisible(false);
tablePanel.setVisible(true);
addPanel.setVisible(true);
} else {
loginPanel.setVisible(true);
tablePanel.setVisible(false);
addPanel.setVisible(false);
}
Is this the right way to handle page refresh with History.addValueChangeHandler? I would appreciate any help.
GWT application is a single page application. It means that if your reload page, the state of your application will be lost. What you can do, is to use local storage to store same state data, but that is not a good idea for an authentication data.
I recommend you to refactor your code in a way that the authentication is done against the back end and your GWT client will recover it's state from back end data when user refreshes the page.

Codename one. Facebook login issues

I am having problem with facebook login in my cn1 app. I followed all the instructions given here: http://www.codenameone.com/facebook-login.html. I create a new instance of FacebookConnect then I set the clientId, secret etc. Then I set a LoginCallback and call doLogin(). However when I tried to run it on my device the screen just loads and it never stops. It doesn't even call LoginFailed. It just never stopped loading.
Here is my code:
faceBookButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
fb.setClientId("XXXXXXXXXXXXXXXX");
fb.setClientSecret("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
fb.setRedirectURI("");
fb.setCallback(new LoginCallback(){
#Override
public void loginFailed(String errorMessage) {
Dialog dg = new Dialog();
dg.setDisposeWhenPointerOutOfBounds(true);
dg.setTitle("Login succeeded");
dg.show();
}
#Override
public void loginSuccessful() {
String token = fb.getAccessToken().getToken();
Dialog dg = new Dialog();
dg.setDisposeWhenPointerOutOfBounds(true);
dg.setTitle("Login succeeded");
dg.show();
}
});
fb.doLogin();
}
});
Check out the full guide on facebook login here.
On login success you need to show a new Form and not a Dialog as you are moving away from the login screen of your application. There is a full end to end sample in the chat tutorial.

GWT - Loading screen onButtonClick

I'm trying to create a loading screen (in this case a PopUp Panel) everytime I click on a button and to hide the screen when the processing is done.
But the problem is that the loading screen never appears.
If I delete the line that hides the loading screen:
//HIDES THE LOADING POPUP
closeLoadingFilter();
The loading screen appears but only until everything finished processing. (not inmediately after I click the button).
I think all the processing in the button handler must be completed before anything appears on the screen. So when the processing is complete the popup is hidden before it was ever showed on the screen.
How can I solve this problem. By the way there is no Async call in the processing, everything is in-memory processing and the drawing of google visualizations with the in-memory information
Thank you all
Here is the code:
buttonFilter.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
//SHOWS THE LOADING POPUP
showLoadingFilter();
//ALL THIS TAKES AROUND 4 SECONDS
//THERE IS NO ASYNC CALL
//EVERYTHING IS IN-MEMORY PROCESSING
//AND DRAWING OF GOOGLE VISUALIZATION
listValues.clear();
listFields.clear();
CreateListFiltersSingle();
GetFilterSingleOptions();
RunFilter(dashboardProductos);
DrawVisualizations2();
//HIDES THE LOADING POPUP
closeLoadingFilter();
}
})
public void showLoadingFilter() {
popupFilterLoading.clear();
popupFilterLoading.add(new Label("Please wait"));
popupFilterLoading.setGlassEnabled(true);
popupFilterLoading.center();
isFilterLoading = true;
popupFilterLoading.show();
}
public void closeLoadingFilter() {
if (isFilterLoading) {
popupFilterLoading.hide();
isFilterLoading = false;
}
}
You can call methods asynchronously using a scheduler. The code below might solve your problem.
submit.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showLoadingFilter();
// Waits for the loading pop-up to be displayed before starting anything
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
#Override
public void execute() {
listValues.clear();
listFields.clear();
CreateListFiltersSingle();
GetFilterSingleOptions();
RunFilter(dashboardProductos);
DrawVisualizations2();
closeLoadingFilter();
}
});
}

How to properly implement facebook login for GWT facebook app?

I am creating an app on Facebook and am trying to figure out what the proper way to authenticate and log into the app is. I don't want it to be accessible when they log out of Facebook and currently using OAuth 2.0 the app still totally functions by going to apps.facebook.com/myappname, even though the top bar to log into Facebook is there.
Here is my onModuleLoad :
public void onModuleLoad() {
AuthRequest req = new AuthRequest(FACEBOOK_AUTH_URL, FACEBOOK_CLIENT_ID);
AUTH.login(req, new Callback<String, Throwable>() {
#Override
public void onSuccess(String token) {
f_token = token;
startAppAfterLogin();
}
#Override public void onFailure(Throwable caught) {
Window.Location.assign("https://www.facebook.com/login.php");
}
});
}
Obviously the startAppAfterLogin() is still being called when they have logged out, anyone have any ideas what to do?