i´m reading the documentation of paypal https://developer.paypal.com/limited-release/paypal-mobile-checkout/android/ ,in the example show
but i have the next error, the parameters doesn´t match. Only works when i remove this parameter
BuildConfig.APPLICATION_ID + "://paypalpay", how i can pass the parameter even later?
config= PayPalConfiguration().environment(PayPalConfiguration.ENVIRONMENT_SANDBOX).clientId(client_id)
.environment(CONFIG_ENVIRONMENT)
.merchantName("Example Merchant")
.merchantPrivacyPolicyUri(Uri.parse("https://www.example.com/privacy"))
.merchantUserAgreementUri(Uri.parse("https://www.example.com/legal"))
var i= Intent(this, PayPalService::class.java)
i.putExtra(PayPalService.EXTRA_PAYPAL_CONFIGURATION,config)
startService(i)
Related
I am trying to invoke and android app with certain perameters, can someone please assist me by trying to convert the following code into flutter, I am using the Android Intent flutter package but not having much luck.
Below is the code that i am trying to convert from Native android / Groovy to flutter
val launchIntent = Intent()
launchIntent.action = "CenDroid"
launchIntent.putExtra("Operation", "Sale")
// Get the time
val millisecond: Long = java.lang.System.currentTimeMillis()
val timeString = milliseconds.toString()
launchIntent.putExtra("Time", timeString)
launchIntent.putExtra("Caller", "Caller Name")
// InvocationKey is Sha512 of Sha256 of Sha1 of whatever is sent in the Time field.
var hashed = HashUtils.sha1(timeString)
hashed = HashUtils.sha256(hashed)
hashed = HashUtils.sha512(hashed)
launchIntent.putExtra("InvocationKey", hashed)
launchIntent.putExtra("Amount", 100.0F)
launchIntent.flags = Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
startActivityForResult(launchIntent, 1)
Any assistance would be of great help
Flutter navigate one page to another page by using this
Navigator.push(
context,
MaterialPageRoute(builder: (context) =>SecondRoute()),
);
to see parameter pass from one page to another page
Passing data
I'm trying to authenticate an end-user in an android app written in C# (Xamarin.Android).
I decided to try and use NuGet package Google.Apis.Oauth.v2 which seems to expose an easy to use Oauth client.
LocalServerCodeReceiver.ReceiveCodeAsync throws the following:
I get System.NotSupportedException:"Failed to launch browser with https://XXX.auth.XXX.amazoncognito.com/login?response_type=token&client_id=XXX&redirect_uri=https%3A%2F%2Fwww.google.com&scope=profile%20openid%20email for authorization. See inner exception for details."
and it has an inner exception of System.ComponentModel.Win32Exception:"Cannot find the specified file"
Code:
var clientSecret = new Google.Apis.Auth.OAuth2.ClientSecrets();
clientSecret.ClientId = ...
clientSecret.ClientSecret = ...
var initializer = new Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow.Initializer(
"https://XXX.auth.XXX.amazoncognito.com/login",
"https://XXX.auth.XXX.amazoncognito.com/login");
initializer.Scopes = new List<string> {"profile", "openid", "email"};
initializer.ClientSecrets = clientSecret;
var flow = new Google.Apis.Auth.OAuth2.Flows.AuthorizationCodeFlow(initializer);
var authCodeRequestURL = flow.CreateAuthorizationCodeRequest("https://www.google.com");
authCodeRequestURL.ResponseType = "token";
var uri = authCodeRequestURL.Build();
var cancellationTokenSource = new System.Threading.CancellationTokenSource();
var codeReceiver = new Google.Apis.Auth.OAuth2.LocalServerCodeReceiver();
var task = codeReceiver.ReceiveCodeAsync(authCodeRequestURL, cancellationTokenSource.Token);
Do I need to ask for a specific permission in the application manifest?
Instead of redirecting to www.google.com, I've heard you can redirect to an app, I'm not really sure how to do that, is it http://my_app_package_name or http://my_app_title, something else?
Is it possible not to rely on that library for launching the browser and instead get the RequestUri and start an Activity, if so how will the app become aware the end-user completed the SignIn process and how will the app retrieve the token?
Sorry, but Google.Apis.Oauth.v2 does not support Xamarin, and there's no simple way to get it working.
Unfortunately no Google.Apis.* packages currently support Xamarin.
You might find the Xamarin.Auth package does what you want?
I've figured out how to redirect to an app after authentication in the browser completes.
It's called a "Deep Link" and it's documented at enter link description here, essentially you need to declare an IntentFilter on your Activity, which registers with the Android OS that if someone clicks or an page redirects to a specific URI, your app gets called. The token that's appended to the URI can then be read inside your app.
I am trying to connect to Alexa Voice Service from an Android app following the directions on this page: https://developer.amazon.com/public/solutions/alexa/alexa-voice-service/docs/authorizing-your-alexa-enabled-product-from-an-android-or-ios-mobile-app
Bundle options = new Bundle();
String scope_data = "{\"alexa:all\":{\"productID\":\"" + PRODUCT_ID +
"\", \"productInstanceAttributes\": {\"deviceSerialNumber\":\"" + PRODUCT_DSN + "\"}}}";
options.putString(AuthzConstants.BUNDLE_KEY.SCOPE_DATA.val, scope_data);
options.putBoolean(AuthzConstants.BUNDLE_KEY.GET_AUTH_CODE.val, true);
options.putString(AuthzConstants.BUNDLE_KEY.CODE_CHALLENGE.val, CODE_CHALLENGE);
options.putString(AuthzConstants.BUNDLE_KEY.CODE_CHALLENGE_METHOD.val, "S256");
mAuthManager.authorize(APP_SCOPES, options, new AuthorizeListener());
First, I don't know what APP_SCOPES should be. I set it to:
protected static final String[] APP_SCOPE = new String[]{"profile", "postal_code"};
but I get an error from the server
AuthError cat= INTERNAL type=ERROR_SERVER_REPSONSE - com.amazon.identity.auth.device.AuthError: Error=invalid_scope error_description=An unknown scope was requested
What am I doing wrong and how can I do this right?
The APP_SCOPE is : "alexa:all"
The PRODUCT_DSN can be anything you want, "1234" as per suggestion from Joshua Frank (https://forums.developer.amazon.com/forums/message.jspa?messageID=18973#18973)
The PRODUCT_ID is the ID in the AVS Developper Portal (https://developer.amazon.com/edw/home.html#/avs/list)
The CODE_CHALLENGE the Client Secret in the Security Profile of your application (should be already hashed in S256)
The problem is not with the APP_SCOPES variable, it is actually with the PRODUCT_ID, PRODUCT_DSN variables passed in the scope data.
I faced this exact same issue and have raised a query in amazon developers forum on what needs to be passed in those variables - Alexa authentication issue using beta SDK
Once the PRODUCT_ID, PRODUCT_DSN & CODE_CHALLENGE variables are determined then the authentication should be pretty much straight forward.
The APP_SCOPE should be "alexa:all"
I was trying to export contacts from my application to the native android contacts.
I found the following solution here on this site: Titanium: How to add Contact in Phone book in Android?.
And it kinda works. The intent gets started. Only problem is, that android does not recognize most of the Extras i put in. So almost every field is blank. It does not matter if I replace contactModel with a simple String, the result is the same.
So i was wondering if the keys are simply wrong, but there seems no proper documentation on appcelerator. Probably something has changed over the past years or I am just missing something. Does anybody know how to do it the right way.
Code Snippet:
if (OS_ANDROID) {
var intent = Ti.Android.createIntent({
action : 'com.android.contacts.action.SHOW_OR_CREATE_CONTACT',
data : 'mailto:' + contactModel.get('contact_first_name') + ' ' + contactModel.get('contact_last_name')
});
intent.putExtra('email', contactModel.get('contact_email'));
intent.putExtra('email_type', 'Work');
intent.putExtra('phone', contactModel.get('contact_mobile_number'));
intent.putExtra('phone_type', 'mobile');
intent.putExtra('name', contactModel.get('contact_first_name') + ' ' + contactModel.get('contact_last_name') );
intent.putExtra('address', addressModel.get('address_street') + ", " + addressModel.get('address_city'));
intent.putExtra('address_type', 'Work');
Ti.Android.currentActivity.startActivity(intent);
}
Thx in advance. :)
The first parameter of putExtra() also accepts one of the constants Ti.Android.... So instead of email you would probably have to use Ti.Android.EXTRA_EMAIL.
I think you can find quite a lot in the docs, e.g. here:
EXTRA constant properties in Ti docs
EXTRA constants in Android docs
Android Intents in Ti docs
In my app i'm trying to create a Contact by calling the standard Create/Edit contact Activity.
I've found how to make it work but not exactly the way I like.
For now I manage to call the standard create contact activity with the following intent extra:
Intent i = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, Uri.parse(String.format("tel: %s", data.getPhone())));
i.addCategory(Intent.CATEGORY_DEFAULT);
i.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true);
i.putExtra(ContactsContract.Intents.Insert.NAME, data.getName());
i.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
i.putExtra(ContactsContract.Intents.Insert.PHONE, org.getPhone());
i.putExtra(ContactsContract.Intents.Insert.POSTAL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
i.putExtra(ContactsContract.Intents.Insert.POSTAL, org.getAddress() + " " + org.getZipCode());
i.putExtra(ContactsContract.Intents.Insert.EMAIL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
i.putExtra(ContactsContract.Intents.Insert.EMAIL, org.getEmail());
startActivity(i);
All the data is filled properly except the address field as you can see in the following picture: http://img689.imageshack.us/img689/1073/capturevvm.png
I'd like to specify each part of the address in the separate field. Is there a way to do it with an Intent?
I tried this, but it did not work.
i.putExtra(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
i.putExtra(ContactsContract.CommonDataKinds.StructuredPostal.STREET, "toto");
i.putExtra(ContactsContract.CommonDataKinds.StructuredPostal.CITY, "paris");
Any idea?
contactIntent.putExtra(ContactsContract.Intents.Insert.POSTAL, "2 rue de Romme, 75000 Paris");
contactIntent.putExtra(ContactsContract.Intents.Insert.POSTAL_TYPE, ContactsContract.CommonDataKinds.StructuredPostal.TYPE_WORK);
You can add the contact using the technique at New contacts created using ContactsContract do not appear in Contacts app
Then show it using your technique.