Initialize Instabug without showing hint prompt - android

I need to initialize Instabug in my Android application but do now want it to show the hint prompt saying "Shake your device etc." when user just opened the app. Instead I want to show that after user has already logged in.
I initialize Instabug with the following code:
new Instabug.Builder(this, instaKey)
.setInvocationEvent(InstabugInvocationEvent.SHAKE)
.setShakingThreshold(1100)
.build();
So is there a way to disable that hint prompt in a first place place?
I tried to set .setPromptOptionsEnabled(false, false, false) but it seems this does not what I need.
I cannot find any documentation about this.

You can disable showing it by setting false to setIntroMessageEnabled(boolean) API example:
new Instabug.Builder(this, instaKey)
.setInvocationEvent(InstabugInvocationEvent.SHAKE)
.setShakingThreshold(1100)
.setIntroMessageEnabled(false)
.build();
and then whenever the User is logged in you can show the intro message by invoking it manually example:
Instabug.showIntroMessage();
And by the way the .setPromptOptionsEnabled(true, true, true) is used for controlling prompt Options visibility [talk to us, report a bug, send a feedback] as described in the official docs here: http://docs.instabug.com/docs/enabled-features

Related

Delay in Google OneTap SignIn / SignUp popup display on Android

I have implemented Google Onetap SignIn in my application. Everything is working fine, the only issue that I am observing is that on certain devices the pop-up often takes 7-10 seconds to display. Especially in case of Sign-In popup.
Since I have multiple login options available in the app it might so happen that before I can show the user his last used google account to login (via OneTap popup), he gets enough time to click on any other option (eg, Facebook) & it becomes a poor experience.
Since this pop-up is displayed by play-services, I don't see how I can optimise this time taken.
As per the code, it seems the call to
contract
.getOneTapClient()
.beginSignIn(getSignInRequest(isRegistering))
is the one taking the most time. It seems the code that queries for user's on device Google Accounts.
Using below code structure. Adding for reference
contract.getOneTapClient().beginSignIn(getSignInRequest(isRegistering))
.addOnSuccessListener { result: BeginSignInResult ->
try
{
contract.startIntentSenderForResult(
result.pendingIntent.intentSender, requestCode,
null, 0, 0, 0, null)
successCallback?.onSuccess(isRegistering, "Rendering Popup")
val timeTaken = if(isRegistering) System.currentTimeMillis() - signUpTime
else System.currentTimeMillis() - signInTime
BBLogUtils.logWithTag(TAG, "Completed in ${timeTaken/1000.0}s")
}
catch (e: IntentSender.SendIntentException)
{
failureCallback?.onFailure(isRegistering, e, ERROR_INTENT_SENDER_EXCEPTION)
}
}
.addOnFailureListener { e: Exception ->
// No saved credentials found.
// OR Temporarily blocked due to too many canceled sign-in prompts.
BBLogUtils.logWithTag(TAG, "Exception | registering=$isRegistering|rCount=$rCount | Error= ${e.message}")
failureCallback?.onFailure(isRegistering, e, ERROR_NO_CREDENTIALS_FOUND)
}
SignIn request object is the standard as prescribed by the docs
private fun getSignInRequest(isRegistering: Boolean): BeginSignInRequest
{
return BeginSignInRequest.builder()
.setGoogleIdTokenRequestOptions(BeginSignInRequest.GoogleIdTokenRequestOptions.builder()
.setSupported(true) // So that we receive the idToken in result
.setServerClientId(contract.getGoogleAndroidClientId())
/*
* true: for Registration ie. showing all accounts
* false: for return user signIn, ie. showing only previously used accounts
**/
.setFilterByAuthorizedAccounts(!isRegistering)
.build())
.build()
}
Another related question to this feature.
On the first launch of the app on device I saw this additional pop-up
Is there someway this can be skipped ?
Answering 2nd part of my own query here.
After a lot search I still haven't bee able to find a workaround for skipping the process. Turns out that this popup is medium for play services to inform the user about the new sign-in experience.
I observed that if I installed another app using Google Onetap (eg. Reddit or PIntrest), the same pop-up appeared there as well. Also, its shown only once to a user, ie. if the pop up was shown in the Reddit app then it won't come in my app & vice-versa.
In addition, if you wan't to repro this scenario, you can clear the storage of Google Play Services. For some duration, it might show error: 16: App is not whitelisted, but after a while, you will get the How It Works pop-up again.

16: Skipping password saving since the user is likely prompted with Android Autofill

I am integrating google smart lock in my android application but in some devices i am getting this error when trying to save credentials to google. I am using following code to save credentials -
Credential credential = new Credential.Builder(email)
.setPassword(password)
.build();
saveCredentials(credential);
After search on google for this solution found that need to disable auto-fill feature in application to save the password.
Try 1 - Put the following code in activity for commit autofillmager in specific activity and disable autofill. But it is not working.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
AutofillManager autofillManager = getSystemService(AutofillManager.class);
autofillManager.commit();
getWindow()
.getDecorView()
.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
}
Try 2 - Put following in properties in EditText
android:longClickable="false"
longClickable should stop autofill but it is not working.
android:importantForAutofill="no"
Also try with importantForAutoFill but it is also not working.
I removed all the code for manual saving and just added
android:autofillHints="username" for login field and android:autofillHints="password" for password field in the sign in form. Password saving dialog appears all the same, thanks to the Android's Autofill service.

How to close google pay dialog programmatically

In business logic we have a timer So if timer runs out we need to stop user from paying using google pay. For that we want to dismiss google pay dialog programmatically. We dont find any solution in this sample project. This is the link for google pay sample project: https://github.com/payeezy/google_pay. So please help us to solve this.
val transaction = PaymentsUtil.createTransaction(price)
val request = PaymentsUtil.createPaymentDataRequest(transaction)
futurePayTask = mPaymentsClient.loadPaymentData(request)
// Since loadPaymentData may show the UI asking the user to select a payment method, we use
// AutoResolveHelper to wait for the user interacting with it. Once completed,
// onActivityResult will be called with the result.
AutoResolveHelper.resolveTask<PaymentData>(futurePayTask, this, LOAD_PAYMENT_DATA_REQUEST_CODE)
Please tell me how to close the dialog programmatically.Thanks in advance.

How to avoid XMLHttpRequest credentials (NTLM) from being cached in phonegap/cordova?

I've been wondering where (in Android/ iOS) the cookie received from an XMLHttpRequest gets stored...
The situation:
I perform an XHR-request to authenticate. For some reason this starts a kind of a session and all other requests I perform do not need credentials anymore. This situation is wanted, but there is a section in the application where other credentials are needed. When I perform another XHR-request, it does not matter which credentials I use, it will keep using the credentials I entered at first.
What I use:
jQueryMobile
Angular
What I noticed [ANDROID]:
The credentials or the session gets killed on app restart!
(NOT WHEN IN BACKGROUND - Like when backbutton is pressed - IT NEEDS TO BE CLOSED COMPLETELY). So then I have to login again.
What I tried without success:
Adding a param to the URL when I want new credentials to be used.
var xhr = new XMLHttpRequest;
xhr.open('GET', 'test.html?_=' + new Date().getTime());
xhr.send();
The InAppBrowser functionality:
window.open("index.html", "_self",
"location=no,clearsessioncache=yes");
Deleted the applicationCache from the Cordova File-plugin.
A plugin which I thought would help: https://github.com/bez4pieci/Phonegap-Cookies-Plugin
What I want:
I have no clue where to find that session anymore... I really want to know where it's stored. I need a way to delete/ clear it so I can perform another succesful call with other XMLHttpCredentials.
Remember I still want to use the cache functionality the XMLHttpRequest automatically provides.
Any help from experts would be appreciated.
As far as I know, the only way to clear these credentials on Android is by restarting the app. It's possible to do this programmatically if you really need to.
On iOS you can manage saved credentials in the sharedCredentialStorage. For example, to remove all credentials:
NSDictionary* credentialsDict = [[NSURLCredentialStorage sharedCredentialStorage] allCredentials];
for (NSURLProtectionSpace* protectionSpace in credentialsDict){
NSDictionary* userNameDict = credentialsDict[protectionSpace];
for (NSString* userName in userNameDict){
NSURLCredential* credential = userNameDict[userName];
[[NSURLCredentialStorage sharedCredentialStorage] removeCredential:credential forProtectionSpace:protectionSpace];
}
}
In order to access the native APIs, you'll have to build a custom plugin.
The solution I found for Android was not to restart the entire app, but to isolate the login activity in a separate process, then override the onDestroy() method by adding Process.killProcess(Process.myPid()).
In manifest:
<activity
android:name=".Activities.AdfsLoginActivity"
android:noHistory="true"
android:excludeFromRecents="true"
android:process=":adfsLoginProcess"
android:windowSoftInputMode="stateHidden|adjustResize" />
In LoginActivity:
#Override
protected void onDestroy() {
super.onDestroy();
//kills current process - adfsLoginProcess
Process.killProcess(Process.myPid());
}
This solution is not perfect (as I am not a fan of Process.killProcess()), but it seems far better than killing the entire app and scheduling a restart. If anyone has a better solution, please share.

How can I display a custom notification message with Malcom Android SDK?

I would like to display the notification message inside the app but not as it is displayed by the Malcom SDK by default, which displays a predefined dialog when I open the app.
Can I modify the default behavior of the library to show the message my own way?
Thank you very much
In the latest Malcom Android SDK 2.0.5 things have changed. Now you can use a NotificationHandler if you want to handle the notification in a custom way.
See the documentation about that:
https://github.com/MyMalcom/malcom-lib-android/blob/master/doc/Notifications.md#check-notification
You can avoid the default behavior using the moduleNotificationsRegister() method with false in the showAlert param.
Then, to get the notification's message, you just need to add this on the onCreate() of your launch Activity:
String message = null;
if(getIntent()!=null && getIntent().getExtras()!=null){
message = (String)getIntent().getExtras().get(MCMNotificationModule.ANDROID_MESSAGE_KEY);
}

Categories

Resources