I followed the standard procedure to add a Google plus button:
<com.google.android.gms.plus.PlusOneButton
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="#+id/plus_one_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
plus:annotation="bubble"
plus:size="standard(none)" />
It is linked to the app's Google Play page. It is initialized in onResume as recommended:
_PlusOneButton.initialize("https://play.google.com/store/apps/details?id=net.mydomain.myapp", 0);
The button gets the count correctly initially, but the count never changes. The Google Play page shows the count keeps changing (increasing) as expected. I have been curious about activityRequestCode in initialize (String url, int activityRequestCode). I do not know what it does.
Could anyone shed some light on this?
Related
When i upload a relese to Google Play Console, after internal testing y have a warning (Accessibility => Content labeling) associated to this component.
<ImageButton .../>
Here the recomendation is use android:contentDescription
Then i add xmlns:android="http://schemas.android.com/apk/res/android"
and:
<ImageButton android:contentDescription="bla bla" .../>
But i get an error: The property contentDescription was not found in type ImageButton.
I try to use xct:SemanticEffect.Description and i have not compiler error but in Google Play Console i still see the warning.
More Information:
Full component code:
<ImageButton BackgroundColor="Transparent" Margin="5" xct:SemanticEffect.Description="abrir menú" Clicked="OnBackButtonClicked" >
<ImageButton.Source>
<FontImageSource FontFamily="FAL" Glyph="" Color="{StaticResource Gray3}" Size="25"/>
</ImageButton.Source>
</ImageButton>
Google Play Console - Pre-launch report details - Accesibility tab
Content labeling warning for this component
As already pointed out, you cannot add android:contentDescription="bla bla" directly to the ImageButton one is from the Android platform, the latter is on the Xamarin.Forms level.
If you use the Xamarin Community Toolkit and apply the SemanticEffect.Description="bla bla" that should translate into the contentDescription on Android. If that is not the case, I would be curious to know what the exact warning is that you get after applying it.
As the title says, How could I make that LocalTime.now update continuously, essentially becoming somewhat into a clock?
var current = LocalTime.now()
Current.text = current.toString()
//Current is the textView id in xml
// this currently prints out what the local time is at app launch.
Use TextClock
This shows the time and updates it automatically you don't have to do anything, please refer to see in detail.
<TextClock
android:id="#+id/textClock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:format12Hour="hh:mm:ss a" />
https://developer.android.com/reference/android/widget/TextClock.html
I recently implemented Algolia on my app successfully just like the examples.
But the initial search takes about 5 to 7 seconds and I couldn't find a way to make it faster after checking the whole library code and documentation. After the initial search, search becomes very fast.
There is nothing unusual in my implementation but maybe you can see something that I don't. The following code is from the activity where I initialize Algolia:
Searcher searcher = new Searcher(ALGOLIA_APP_ID, ALGOLIA_SEARCH_API_KEY, ALGOLIA_INDEX_NAME);
searcher.setQuery(new Query("word").setExactOnSingleWordQuery(Query.ExactOnSingleWordQuery.ATTRIBUTE));
searcher.addNumericRefinement(new NumericRefinement("CountryId", NumericRefinement.OPERATOR_EQ, 1));
InstantSearch helper = new InstantSearch(this, searcher);
helper.setSearchOnEmptyString(false);
helper.search();
And this is the related xml layout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp"
android:paddingRight="10dp"
android:paddingLeft="1dp"
android:paddingTop="6dp">
<com.algolia.instantsearch.ui.views.SearchBox
android:id="#+id/searchBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:queryHint="#string/search_text_hint"
algolia:searchIcon="#drawable/icn_search_big"
algolia:closeIcon="#drawable/icn_clear_filled_big"
android:queryBackground="#drawable/sarch_query_shape"
android:background="#drawable/search_shape"
algolia:autofocus="true"
algolia:submitButtonEnabled="false" />
</FrameLayout>`
<com.algolia.instantsearch.ui.views.Hits
android:id="#+id/hits"
android:layout_width="match_parent"
android:layout_height="match_parent"
algolia:autoHideKeyboard="true"
algolia:hitsPerPage="6"
android:layout_below="#+id/searchBarParentLayout"
algolia:infiniteScroll="false"
algolia:itemLayout="#layout/search_item_algolia_row"/>
Do you have any idea what can be the issue here?
I'm glad that the issue disappeared when you switched to another wifi.
For future readers that may encounter network issues with InstantSearch Android:
First of all, build and run one of our demo applications
If you see no problem running the example application, you can try using a proxy like Charles to investigate what's happening between your app and the network
If your problem persists when running the examples, or if you are following the documentation, send an email to support#algolia.com describing the issue with a sample of your code!
I'm unlocking achievement using this simple method from developers docs:
Games.Achievements.unlock(getApiClient(), "my_achievement_id");
Achievement unlocks, but no popup shows up. There is also no popup when logged in to Google Play Games - which is connected.
Just add a view to the layouts you want to display achievements on like this:
<FrameLayout
android:id="#+id/gps_popup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp" />
When you have your layout ready you neet to execute this inside your Activity or Fragment:
Games.setViewForPopups(getApiClient(), findViewById(R.id.gps_popup));
You have to be sure, that your GoogleApiClient is connected though, otherwise your app will crash.
<FrameLayout
android:id="#+id/gps_popup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp" />
This is the same in Jacek Kwiecień answer
GamesClient gamesClient = Games.getGamesClient(MainActivity.this, GoogleSignIn.getLastSignedInAccount(context));
gamesClient.setViewForPopups(findViewById(R.id.gps_popup));
This changed because setViewForPopups with 2 parameters is deprecated.
Jacek and user3782779 answers didn't work for me, I had to do the following:
GamesClient gamesClient = Games.getGamesClient(this, GoogleSignIn.getLastSignedInAccount(this));
gamesClient.setViewForPopups(findViewById(android.R.id.content));
gamesClient.setGravityForPopups(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
Had the same problem. I have solved it by adding icon to the achievement. I am not kidding, it is really strange but it started to work after that. Please note that I am talking about not published project, I was just testing my app and wondering what is going on.
The ONLY view that worked for my case of having multiple activities was:
activity.window.decorView.findViewById(android.R.id.content)
I had the same problem with the achievement popup. The "Welcome Back" popup was showing correctly by just using my own View, but once I started opening other screens where I wanted to show the achievement unlocked popup, it was not working. The only thing that ended up working was using the content view from the decorView
val gamesClient = Games.getGamesClient(activity, googleSignInAccount)
gamesClient.setGravityForPopups(Gravity.TOP or Gravity.CENTER_HORIZONTAL)
gamesClient.setViewForPopups(activity.window.decorView.findViewById(android.R.id.content))
You can call this code from any new activity you open and the pop-up will show up there as soon as you unlock your achievements.
I am following the steps mentioned in Google developers site to implement sign in and sign out in my app.
The code to add the sign-in and sign-out button as mentioned there is:
<!-- sign-in button -->
<com.google.android.gms.common.SignInButton
android:id="#+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- sign-out button -->
<Button
android:id="#+id/sign_out_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sign Out"
android:visibility="gone" />
In the sample mentioned over there, the sign out button looks very different(and odd) from the sign out button.
Is this because the sign out button is not taken from com.google.android.gms?
Is there a proper sign-out button available in com.google.android.gms?
There is no sign-out button provided by google.
If you would like extra buttons in the same style as google's, you will need to create them yourself.
But it's a lot easier than it sounds, there are many resources provided by Google to show you how to create a button that looks just like a Google button. Take a look over here:
https://developers.google.com/+/branding-guidelines
Here is a little example I made in microsoft paint to show you the kind of stuff you can make!
You can make your button look the same as <com.google.android.gms.common.SignInButton>, adding a predefined style to your button with the xml tag style:
style="#style/FirebaseUI.Button.AccountChooser.GoogleButton"
Note that its a FirebaseUI style and you can put the Button text that you want.
How about : change text Sign in to Sign out.
layout.xml
<com.google.android.gms.common.SignInButton
android:id="#+id/sign_out_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
kotlin.kt
val signOutButton: SignInButton = findViewById(R.id.sign_out_button)
signOutButton.setSize(SignInButton.SIZE_STANDARD)
signOutButton.setOnClickListener { signOut() }
val txtLogout = signOutButton.getChildAt(0) as TextView
try {
txtLogout.setText("Sign out")
} catch (e: Exception) {
//e.printStackTrace()
}