I'm new to Android. I have one application in which I'm planning to add App Rate function. I found below library for it
Apprate Library
final RatingDialog ratingDialog = new RatingDialog.Builder(this)
.threshold(3)
.session(7)
.onRatingBarFormSumbit(new RatingDialog.RatingDialogFormListener() {
#Override
public void onFormSubmitted(String feedback) {
}
}).build();
ratingDialog.show();
I have impemented it but there is nothing written for feedback email related code. Can some one please tell me where I should write my email so when user can submit feedback? Can I get an email?
Thanks!
Any action after submit would be done inside:
public void onFormSubmitted(String feedback) {
// put the code here
}
Related
I'm building android application with push notifications using Backendless as backend. I encountered a problem with handling buttons. I know that I can push notification with template(from Backendless Console) and there is an option to handle clicks, but I wonder if there is an option to do it all in code, not with template?
I have also searched for similar questions but everything I found was old and deprecated.
I use this function to push notification but I don't know how to set buttons and how to handle button clicks.
public static void sendPushNotification(String channel, String message, String header,
List<String> devices) {
DeliveryOptions deliveryOptions = new DeliveryOptions();
deliveryOptions.setPushSinglecast(devices);
PublishOptions publishOptions = new PublishOptions();
publishOptions.putHeader("android-ticker-text", header);
publishOptions.putHeader("android-content-title", header);
publishOptions.putHeader("android-content-text", message);
Backendless.Messaging.publish(channel, message, publishOptions, deliveryOptions,
new AsyncCallback<MessageStatus>() {
#Override
public void handleResponse(MessageStatus response) {
}
#Override
public void handleFault(BackendlessFault fault) {
}
});
}
Solution :
https://support.backendless.com/t/customise-push-notification/10863/20
I finally found answer, if you had similar problem please go here and check:
https://support.backendless.com/t/customise-push-notification/10863/20
I followed the guide on the Android docs but for some reason nothing is showing when i start my app.
I even tried logging the listeners but nothing is showing up in logcat.
I also changed the ad technology in admob setting to Custom set of ad technology providers, but still not working.
My code
ConsentInformation consentInformation = ConsentInformation.getInstance(getApplicationContext());
ConsentInformation.getInstance(getApplicationContext()).addTestDevice("6AE7D8950FE9E464D988F340C0D625B0");
ConsentInformation.getInstance(getApplicationContext()).
setDebugGeography(DebugGeography.DEBUG_GEOGRAPHY_EEA);
String[] publisherIds = {""};
consentInformation.requestConsentInfoUpdate(publisherIds, new ConsentInfoUpdateListener() {
#Override
public void onConsentInfoUpdated(ConsentStatus consentStatus) {
// User's consent status successfully updated.
Log.d(TAG,"onConsentInfoUpdated");
}
#Override
public void onFailedToUpdateConsentInfo(String errorDescription) {
// User's consent status failed to update.
Log.d(TAG,"onFailedToUpdateConsentInfo");
}
});
form = new ConsentForm.Builder(this, privacyUrl)
.withListener(new ConsentFormListener() {
#Override
public void onConsentFormLoaded() {
// Consent form loaded successfully.
Log.d(TAG,"form loaded!");
form.show();
}
#Override
public void onConsentFormOpened() {
// Consent form was displayed.
}
#Override
public void onConsentFormClosed(
ConsentStatus consentStatus, Boolean userPrefersAdFree) {
// Consent form was closed.
}
#Override
public void onConsentFormError(String errorDescription) {
// Consent form error.
Log.d(TAG,"form error!");
}
})
.withPersonalizedAdsOption()
.withNonPersonalizedAdsOption()
.withAdFreeOption()
.build();
form.load();
Gradle
dependencies {
classpath 'com.google.gms:google-services:4.3.2'
}
implementation 'com.google.android.ads.consent:consent-library:1.0.7'
implementation 'com.google.android.gms:play-services-plus:17.0.0'
implementation 'com.google.android.gms:play-services-ads:18.2.0'
EDIT
I tried it on a project which was pre android x and now it calls the listener onFailedToUpdateConsentInfo.
With following error message:
onFailedToUpdateConsentInfoCould not parse Event FE preflight response.
Searched a bit and found this could be because of an invalid pub id, but i'm certain i'm using the right one.
1) I think you forget to check isRequestLocationInEeaOrUnknown() method.
It will return true If user already agreed to the consent. In this case, you don't need to ask it again. I think you already agreed to consent.
wrap your code with
if(ConsentInformation.getInstance(context).isRequestLocationInEeaOrUnknown()){
//setup admob
}else{
//Ask for consent
}
2) You have to call form.show(); to present the form to the user, check Google Doc
I was still using test app id and test ad ids, remove them and change it with your id's and make sure you use it as a testdevice so you don't violate admob policies.
Like this
adLoader.loadAd(new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build());
I'm making a GWT application that requires users to log in. If username and password are correct, then they are allowed to use the application.
What needs to be implemented in the onSuccess() method to make this possible ?
Thanks in advance.
DBConnectionAsync rpcService = (DBConnectionAsync) GWT.create(DBConnection.class);
ServiceDefTarget target = (ServiceDefTarget) rpcService;
String moduleRelativeURL = GWT.getModuleBaseURL() + "DBConnectionImpl";
target.setServiceEntryPoint(moduleRelativeURL);
rpcService.authenticateUser("admin", "admin", new AsyncCallback<User>() {
#Override
public void onSuccess(User result) {
// What to do here to open or redirect the user to a new page ?
}
#Override
public void onFailure(Throwable caught) {
// Failure
}
});
A simple way of doing this would be to fire an event to the eventbus of you application and then catch this event in the main controller of your application, which would trigger the opening of the right page.
This two pages should explain everything you possibly need to know to do this:
Everything about the architecture GWT MVP
Everything about activity and places (navigation and history)
Just as if you need more information.
From onSuccess you can call a method which will be defined in a corresponding presenter and from that method you can fire an event which will allow user to enter into your application only on successful authentication .
Situation
I'm migrating a project from Wicket 1.5.7 to Wicket 6.12, one of the errors I get is explained below.
Code
#Override
protected void onSubmit() {
final String usernameValue = mail.getModelObject();
//Password is left empty in this particular case
AuthenticatedWebSession.get().signIn(usernameValue,"");
if (!continueToOriginalDestination())
{
setResponsePage(getApplication().getHomePage());
}
}
Error
This is the error I got when changing wicket versions: The operator !
is undefined for the argument type(s) void
Note: I see this error when hovering over !continueToOriginalDestination
What did I try
In my search on stackoverflow I came accross this question:
continueToOriginalDestination does not bring me back to originating page
Also checked this topic on apache wicket:
http://apache-wicket.1842946.n4.nabble.com/Handling-ReplaceHandlerException-on-continueToOriginalDestination-in-wicket-1-5-td4101981.html#a4115437
So I changed my code to this:
#Override
public void onSubmit() {
final String usernameValue = mail.getModelObject();
AuthenticatedWebSession.get().signIn(usernameValue,"");
setResponsePage(getApplication().getHomePage());
throw new RestartResponseAtInterceptPageException(SignInPage.class);
}
Question
The old situation nor the code change seem to work in my particular case.
Maybe it's a small change, is my new code wrong, how should this work?
Has Wicket changed that much, so that the old code is not supported anymore, or can !continueToOriginalDestination be used as well?
This helps
http://www.skybert.net/java/wicket/changes-in-wicket-after-1.5/
In 1.5, you could do the following to break out of the rendering of one page, go to another page (like login page) and then send the user back to where he/she was:
public class BuyProductPage extends WebPage {
public BuyProductPage() {
User user = session.getLoggedInUser();
if (user null) {
throw new RestartResponseAtInterceptPageException(LoginPage.class);
}
}
}
and then in LoginPage.java have this to redirect the user back to BuyProductPage after he/she's logged in:
public class LoginPage extends WebPage {
public LoginPage() {
// first, login the user, then check were to send him/her:
if (!continueToOriginalDestination()) {
// redirect the user to the default page.
setResponsePage(HomePage.class);
}
}
}
The method continueToOriginalDestination has changed in Wicket 6, it's now void which makes your code look more magic and less than logic IMO:
public class LoginPage extends WebPage {
public LoginPage() {
// first, login the user, then check were to send him/her:
continueToOriginalDestination();
// Magic! If we get this far, it means that we should redirect the
// to the default page.
setResponsePage(HomePage.class);
}
}
I am trying to implement an online leaderboard for the newest version of my app. I followed the tutorial found here:
http://swarmconnect.com/admin/docs/leaderboard
Here is relevant code from MainMenu.java.
public void onCreate(Bundle savedInstanceState) {
// if user has logged in before, automatically login user without showing the home screen
if(Swarm.isEnabled()) {
autoLogin();
} else {
login();
}
if(Swarm.isEnabled() == false) {
autoLogin();
}
}
public void autoLogin() {
Swarm.init(MainMenu.this, ...., "...");
}
public void login() {
Swarm.init(MainMenu.this, ..., "...");
}
}
Results.java displays after the quiz is over. Here is the relevant code in there:
public void submitScore(long score) {
SwarmLeaderboard.submitScore(LEADERBOARD_ID, score);
}
Here is relevant code from Highscores.java:
public void showLeaderboard() {
SwarmLeaderboard.showLeaderboard(LEADERBOARD_ID);
}
That is all the code I have and that is all that was on the SwarmConnect website. I am able to login from the MainMenu successfully and the app never crashes. But when I go to Highscores.java nothing is displayed. There has to be more code but I don't see any docs anywhere for instructions past the ones in the link at the top.
My question is how to display the scores that were submitted from the Results.java page.
Okay, I have SwarmConnect on a simple game I made.
Here's the code I used to show LeaderBoards: Swarm.showLeaderboards(); It was Swarm and not SwarmLeaderboard.
Please make sure you've followed the Swarm setup docs (http://swarmconnect.com/admin/docs/setup). Particularly the section for extending SwarmActivity (or alternatively, calling setActive() and setInactive()). My guess is that Swarm doesn't have an active Context to work with, and thus won't display new screens.