Uber deeplink and universal url crashes android application - uber-api

I am experiencing problem on Android with opening of Uber deeplink and universal url, uber hangs to a white screen and returns to calling activity on back presses.
I have tried:
Method 1:
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId(<client-id>)
.setClientSecret(<client-secret>)
.setServerToken(<server-token>)
.build();
Location location = Singleton.getInstance(context).getOneTimeLocation().getLocation();
RideParameters rideParams = new RideParameters.Builder()
.setPickupLocation(location.getLatitude(), location.getLongitude(), "Your", "Your")
.setDropoffLocation(latitude, longitude, address, "")
.build();
RideRequestDeeplink deeplink = new RideRequestDeeplink.Builder(context)
.setSessionConfiguration(config)
.setFallback(Deeplink.Fallback.MOBILE_WEB)
.setRideParameters(rideParams)
.build();
// deeplink.execute();
try {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(deeplink.getUri());
((BaseActivity) context).startActivity(intent, null, false);
} catch (Exception e) {
}
Note:
In Method 1, I tried both deeplink.execute() and opening intent with ACTION_VIEW to redirect to browser.
Method 2:
String baseUrl = "https://m.uber.com/ul/?action=setPickup&";
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(baseUrl);
stringBuilder.append("client_id=").append(<client-id>).append("&");
stringBuilder.append("pickup[latitude]=").append(location.getLatitude()).append("&");
stringBuilder.append("pickup[longitude]=").append(location.getLongitude()).append("&");
stringBuilder.append("dropoff[latitude]=").append(latitude).append("&"); stringBuilder.append("dropoff[longitude]=").append(longitude).append("&");
stringBuilder.append("dropoff[formatted_address]=").append(address);
//Opened this url in browser ending in same result
Both the methods had same result, Uber app hangs with white screen.
In Method 2, it provides me with Open link with chrome or uber, if i choose Just Once it opens correctly but if it choose Always option it keeps redirecting me to hang Uber. If i resume this uber in hang state i.e. press home and reselect uber from running application it opens up with supplied data

Related

Custom Parameters are always Null | Firebase Dynamic Links

What I Want to Do
When the user taps the URL, it launches the app and pops up a page within the app based on the included custom parameters.
Problem
I succeeded in launching an Android or iOS app by tapping the URL, but the custom parameter is always null.
What I Did
The URL that users tap is as follows.
https://example.page.link/test/?link=https://test.example.com/?id=${id}&apn=com.example.app
id is custom parameter that I want to get when this URL is called.
I created link on Firebase Console like example.page.link/test.
In initState, call initDeepLinks function.
// openPage opens detail page with id
Future<void> initDeepLinks() async {
final PendingDynamicLinkData? initialLink =
await FirebaseDynamicLinks.instance.getInitialLink();
if (initialLink != null) {
final Uri deepLink = initialLink.link;
print("A: " + deepLink.queryParameters["id"]!);
openPage(deepLink.queryParameters["id"]!);
}
FirebaseDynamicLinks.instance.onLink.listen((dynamicLinkData) {
print("B: " + dynamicLinkData.link.queryParameters["id"]!);
openPage(dynamicLinkData.link.queryParameters["id"]!);
}).onError((error) {});
}
But those two print()s print only A: or B: .
I checked URL that contains ?id=$id and it is correct.
Tried other URL
When I change the URL to
https://example.page.link/?link=https://test.example.com/?id=${id}&apn=com.example.app
(removed `/test` path)
It works with custom parameters only on Android.
But do same on iOS, the browser shows https://test.example.com page and app doesn't appear.
What should I do to make custom parameters?

Xamarin.Forms Taking picture with Plugin.Media not working

I'm using the Plugin.Media from #JamesMontemagno version 2.4.0-beta (which fixes picture orientation), it's working on Adroind 4.1.2 (Jelly Bean) and Marshmallow, but NOT on my Galaxy S5 Neo with Android version 5.1.1.
Basically when I take a picture it never returns back on the page from where I started the process; always returns back to the initial home page.
On devices where it works, when I take a picture, I see that first of all the application fires OnSleep, then after taking the picture fires OnResume.
On my device where is NOT working it fires OnSleep and after taking the picture doesn't fire OnResume, it fires the initialization page and then OnStart.
For this reason it doesn't open the page where I was when taking the picture.
What should I do to make sure it fires OnResume returning to the correct page and not OnStart which returns on initial fome page ?
In addition, when I take a picture it takes almost 30 seconds to get back to the code after awaiting TakePhotoAsync process, and it's too slow!
Following my code:
MyTapGestureRecognizerEditPicture.Tapped += async (sender, e) =>
{
//Display action sheet
String MyActionResult = await DisplayActionSheet(AppLocalization.UserInterface.EditImage,
AppLocalization.UserInterface.Cancel,
AppLocalization.UserInterface.Delete,
AppLocalization.UserInterface.TakePhoto,
AppLocalization.UserInterface.PickPhoto);
//Execute action result
if (MyActionResult == AppLocalization.UserInterface.TakePhoto)
{
//-----------------------------------------------------------------------------------------------------------------------------------------------
//Take photo
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
await DisplayAlert(AppLocalization.UserInterface.Alert, AppLocalization.UserInterface.NoCameraAvailable, AppLocalization.UserInterface.Ok);
}
else
{
var MyPhotoFile = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
Directory = "MyApp",
Name = "MyAppProfile.jpg",
SaveToAlbum = true,
PhotoSize = Plugin.Media.Abstractions.PhotoSize.Small
});
if (MyPhotoFile != null)
{
//Render image
MyProfilePicture.Source = ImageSource.FromFile(MyPhotoFile.Path);
//Save image on database
MemoryStream MyMemoryStream = new MemoryStream();
MyPhotoFile.GetStream().CopyTo(MyMemoryStream);
byte[] MyArrBytePicture = MyMemoryStream.ToArray();
await SaveProfilePicture(MyArrBytePicture);
MyPhotoFile.Dispose();
MyMemoryStream.Dispose();
}
}
}
if (MyActionResult == AppLocalization.UserInterface.PickPhoto)
{
//-----------------------------------------------------------------------------------------------------------------------------------------------
//Pick photo
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsPickPhotoSupported)
{
await DisplayAlert(AppLocalization.UserInterface.Alert, AppLocalization.UserInterface.PermissionNotGranted, AppLocalization.UserInterface.Ok);
}
else
{
var MyPhotoFile = await CrossMedia.Current.PickPhotoAsync();
if (MyPhotoFile != null)
{
//Render image
MyProfilePicture.Source = ImageSource.FromFile(MyPhotoFile.Path);
//Save image on database
MemoryStream MyMemoryStream = new MemoryStream();
MyPhotoFile.GetStream().CopyTo(MyMemoryStream);
byte[] MyArrBytePicture = MyMemoryStream.ToArray();
await SaveProfilePicture(MyArrBytePicture);
MyPhotoFile.Dispose();
MyMemoryStream.Dispose();
}
}
}
};
Please help!! We need to deploy this app but we cannot do it with this problem.
Thank you in advance!
It is perfectly normal to have the Android OS terminate and restart an Activity. As you are seeing, your app's Activity it will be automatically restarted when the camera app exits and the OS returns control to your app. The odds are it just needed more memory in order to take that photo with the Neo's 16MP camera, you can watch the logcat output to confirm that.
Restarted – It is possible for an activity that is anywhere from paused to stopped in the lifecycle to be removed from memory by Android. If the user navigates back to the activity it must be restarted, restored to its previously saved state, and then displayed to the user.
What to do:
So on the Xamarin.Forms OnStart lifecycle method you need to restore your application to a valid running state (initializing variables, preforming any bindings, etc...).
Plug code:
The Android platform code for the TakePhotoAsync method looks fine to me, but remember that the memory for that image that is passed back via the Task will be doubled as it is marshaled from the ART VM back the Mono VM. Calling GC.Collect() as soon as possible after the return will help (but your Activity is restarting anyway...)
public async Task<MediaFile> TakePhotoAsync(StoreCameraMediaOptions options)
{
~~~
var media = await TakeMediaAsync("image/*", MediaStore.ActionImageCapture, options);
In turn calls:
this.context.StartActivity(CreateMediaIntent(id, type, action, options));
Not much less you can really do within the Android OS to popup the Camera.
In addition, when I take a picture it takes almost 30 seconds to get back to the code after awaiting TakePhotoAsync process, and it's too slow!
Is that on your Neo? Or all devices?
I would call that very suspect (ie. a bug) as even flushing all the Java memory after the native Camera Intent/Activity and the restart time for your app's Activity should not take 30 seconds on a oct-core 1.6 GHz Cortex... but I do not have your device, app and code in front of me....

Is there any way to specify facebook-links with the HTTP protocol which opens the app (iPhone/Androdi) if installed?

So I know the Facebook-app supports the fb:// URL scheme. But does it also support a URL scheme for HTTP?
I've tried for instance https://www.facebook.com/Google, and it does not yield an option to open the app, when clicked on from Chrome on an HTC One M8 device. So obviously Facebook haven't defined a URL scheme to match that URL. But they might have created others? Theoretically they could for instance have a scheme that triggered when a sub-url contains /app or something.
My goal is to link to a Facebook profile page which opens in the app if it is installed, and in the browser if not. Without using any Javascript. If facebook have defined a schema matching any HTTP-protocol, it is possible.
I made this work for link to google play with this function, changing te protocol to the facebook could work
public void getpro(View view) {
final String appName = BuildConfig.APPLICATION_ID;
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+appName")));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id="+appName")));
}
}
to:
public void getpro(View view) {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("facebook://facebook.com/inbox")));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com")));
}
}
You can try to achieve this with Intents. I found this:
String uri = "facebook://facebook.com/inbox";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
startActivity(intent);
Intent is used to call other applications while using an application.

Diconnected from App Center through my application using java SDK

I face an issue while running disconnect from app center via my application. here is my source code.
private boolean disconnet(final String oauthConsumerKey, final String oauthConsumerSecret, final String accessToken, final String accessTokenSecret, final String realmID) {
try {
if (accessToken != null && accessTokenSecret != null
&& realmID != null) {
final IAPlatformClient pClient = new IAPlatformClient();
pClient.disconnect(oauthConsumerKey, oauthConsumerSecret, accessToken, accessTokenSecret);
return true;
}
} catch (Exception e) {
System.err.println("Exception : "+e.getMessage());
return false;
}
return false;
}
I get the exception:
Exception :Failed to disconnect: java.lang.NullPointerException null
Can someone help me? Thanks in advance.
We currently have a defect in the development environment that prevents the disconnect from the app center flow to be executed properly. The defect only affects the development environment, the production environment is working correctly.
The defect presents a pop up with a Close button at the end of the sequence and control is returned to the app center Manage My Apps page rather than directing the user to the application's disconnect URL.
To test this after returning to the app center, simply paste the disconnect URL into the browser address box and manually navigate to the disconnect URL.

Logging out from facebook using facebook c# sdk in WP7

I want to implement logout from facebook using facebook C# sdk in my windows phone app
My primary question is how do we logout using Facebook C# SDK in WP7
I found this article in search
Article link
there he is trying to find the logout url using regex, but that did not working in my app
when i try that the browser navigated event is going into infinite loop
you can share any samples/posts related to facebook logout in windows phone 7.
I want logout should happen with out user intervention, after he clicks on a button he should looged out from facebook and from next time he should see the login page
I tried following posts/blogs also but no use.
LINK 1
LINK 2 this giving error while splitting the accesstoken
UPDATE
LogOutButtonCode
FacebookClient _fbClient = new FacebookClient(fbaccess.AccessToken);
var logoutParams = new Dictionary<string, object>();
logoutParams.Add("next", "https://www.facebook.com/connect/login_success.html");
//logoutParams.Add("",)
var logoutUrl = _fbClient.GetLogoutUrl(logoutParams);
BrowserControl.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(BrowserControl_Navigated);
BrowserControl.Navigate(new Uri(logoutUrl.AbsoluteUri));
Navigated Event CODE
if (e.Uri.AbsoluteUri == "https://www.facebook.com/connect/login_success.html")
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
e.Uri.AbsoluteUri returns https://www.facebook.com/home.php
Logout URL i am getting from the server https://www.facebook.com/logout.php?next=https://www.facebook.com/connect/login_success.html
Use FacebookClient.Logout to generate the logout url.
This is the snippet from winforms sample which will work in wp7 with some modifications.
private void btnLogout_Click(object sender, EventArgs e)
{
var fb = new FacebookClient();
var logoutUrl = fb.GetLogoutUrl(new
{
next = "https://www.facebook.com/connect/login_success.html",
access_token = _accessToken
});
var webBrowser = new WebBrowser();
webBrowser.Navigated += (o, args) =>
{
if (args.Url.AbsoluteUri == "https://www.facebook.com/connect/login_success.html")
Close();
};
webBrowser.Navigate(logoutUrl.AbsoluteUri);
}
Make sure to persist the access token somewhere when you login as it is required to logout.