I am working on a cross platform app using xamarin and MVVMcross.
I want to navigate to Login page when the app is in background for a specific amount of time.
I was successfull in implementing the same in android but wasn't able to find a proper solution in ios for this where MVVMCross is used.
Below is my Android code which is working
Intent intent = new Intent(this, typeof(LoginView));
var viewModelRequest = new MvxViewModelRequest(typeof(Core.ViewModels.LoginViewModel));
var serializer = new MvvmCross.Core.Parse.StringDictionary.MvxViewModelRequestCustomTextSerializer();
intent.PutExtra("MvxLaunchData", serializer.SerializeObject(viewModelRequest));
StartActivity(intent);
I need to implement the same in ios. I know I need to write a similar code like in android in WillEnterForeground method of Appdelegate but wasn't able to find a proper solution for it anywhere.
Is WillEnterForeground the right place to do this ?
Can someone please help
I was able to go one step ahead
var view = (IMvxIosView)UIStoryboard.FromName("Tasks", null).InstantiateViewController("LoginView");
var viewController = view.CreateViewControllerFor(viewModelRequest) as UIViewController;
Window.RootViewController = new UINavigationController(viewController);
Window.MakeKeyAndVisible();
Now I am able to get to the login screen when the app comes in foreground again.
But when I click the Login button nothing happens.
Just for more information i am using Storyboards and have overridden CreateIosViewsContainer method of MvxIosSetup in my Setup class.
Any help please as I am relatively very new to ios development?
Related
Currently, I found Windows.ApplicationModel.Calls API. unable to make a call or launch different options available to make a call from my app.
And also I try this Code but still can't implement the Phone call function, any solutions for UWP? Thank You.
if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1,0))
{
PhoneCallManager.ShowPhoneCallUI("0213132131", "my name");
}
I've come with a solution that is working on emulator, I cannot test it on actual device, cause I don't own one.
PhoneCallStore PhoneCallStore = await PhoneCallManager.RequestStoreAsync();
Guid LineGuid = await PhoneCallStore.GetDefaultLineAsync();
PhoneLine = await PhoneLine.FromIdAsync(LineGuid);
PhoneLine.Dial(phoneNumber, nameToBeDisplayed);
You have to add Windows Mobile Extentions for UWP to references of your project as well as declare PhoneCall capability in app manifest.
The line,
PhoneCallManager.ShowPhoneCallUI("0213132131", "my name");
only shows the Call UI. It doesn't make a phone call.
You should use Windows.ApplicationModel.Calls.PhoneLine.Dial to make a phone call. See this for reference https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phoneline.aspx
See this example https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/PhoneCall/cs/Helpers/CallingInfo.cs#L85
I have developed a windows phone 8 application. Now I want to display vserv ads to my application.
I have added the sdk to my application and also applied code to show ads:
public MainPage()
{
InitializeComponent();
VservAdControl VMB = VservAdControl.Instance;
VMB.DisplayAd(zoneID, LayoutRoot);
VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
}
void VACCallback_OnVservAdClosing(object sender, EventArgs e)
{
MessageBox.Show("Ad close by user.");
}
void VACCallback_OnVservAdNoFill(object sender, EventArgs e)
{
if (adGrid != null)
adGrid.Visibility = Visibility.Collapsed;
}
But after closing the ad the application page goes blank, all content, application bar automatically goes blank. After using back arrow that quits my application, i try to relaunch my application but application stuck at the splash screen on the emulator.
Wrap ad control inside a grid. Ad control could have manipulated the grid
I encountered the same issue and they have updated their SDK several times. If you provide the stacktrace they will provide you a fix.
Apart from what you have seen, there are other issues with the SDK. I integrated it few weeks back. So issues could have been resolved after that.
Memory leak. Click the ad or navigate back and forth - you will see the memory ever growing. This is because of events not being detached (withing SDK). I was consistently able to see my app crash in 512 MB emulator when banner ad is loaded (after 4 - 5 times). They could have used weak listeners. You might need to tweak a lot to overcome this issue (In multi page app)
RequestAdCallback throws null pointer exception sometimes crashing
the app. When people use app, they will navigate fast - forcing the
webbrowser to unload. All callbacks should be null pointer exception
free. Make sure that you handle unhandled exception globally otherwise app will not pass certification
It reads WMAppManifest.xml as text not as XML. So I had App element commented in first line before the actual one. It picked title from commented XML element
Application bar is manipulated in many events in the SDK. So you have to make sure that app bar is built dynamically. Test all navigation paths.
SDK assumes user will click the left arrow button which fires ad closing event. Try pressing phone back button instead. The app bar still disappears
SDK documentation requests app to demand ID_CAP_REMOVABLE_STORAGE capability. I don't see a reason to request this capability but I didn't add this
I have emailed them all these details. May be their latest SDK could have resolved these issues. But please do thorough testing after integration.
Add a function to load applicationbar using code
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Default;
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = false;
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton button1 = new ApplicationBarIconButton();
button1.IconUri = new Uri("/Images/sms.png", UriKind.Relative);
button1.Text = "sms";
ApplicationBar.Buttons.Add(button1);
}
and then in VACCallback_OnVservAdClosing event handler call the function
BuildLocalizedApplicationBar()
Please check the following link,
where to add application id and adUnitiD while integrating vserv ads sdk to windows phone 8 application, which is related to your question.
So - I want to make a windows phone app that links to my webpage when I open it - how do i do that? I have the SDK, and tried with the browser, but I can't seem to find anyway to set a homepage?
You could use the WebBrowser control, placing it on an otherwise empty page. This may allow you to fine tune the experience if wish.
But what would be even easier is to just use the WebBrowserTask. This would launch you right back out of your app and into OS's true browser experience. In the App.xaml.cs file, just add the following code:
private void PhoneApplicationService_Launching(object sender, LaunchingEventArgs e)
{
WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.Uri = new Uri("http://my.superawesomewebsite.com", UriKind.Absolute);
webBrowserTask.Show();
}
You app will immediately launch the browser an you don't have to do anything else.
i try to open web browser apk, open one web page.
is it possible to ZOOM IN/OUT of this web page using robotium ?
and i try to open one docx file using open Office apk automation using robotium.
is it possible to ZOOM IN/OUT for this document page using robotium ?
Any one have solution then please help me.
As far i know there is no functionality like that in Robotium.
For a web page you can use the zoomIn() method of a webview that you have gotten a reference to using any number of the ways you can with robotium.
To be able to use this method you will have to cast the view you got from robotium to a WebView and to perform the zoom you will have to run on the uithread. The code would look something like:
final WebView webView = (WebView) Solo.getView(R.id.web_views_id);
instrumentation.runOnMainSync(new Runnable() {
#Override
public void run() {
webView.zoomIn()
}
});
Anyone know if it's now feasible to launch the 'Settings' app from your app? Google Maps does it when you don't have Location Services enabled and you try to locate yourself.
I've seen lots of folks post about it and most answers point to adding a bug in Radar.
In the wild, I know of two apps that show this dialog with ""Turn on Location Services to Allow [app] to Determine Your Location" along side Cancel and Settings buttons where the 'Settings' button will take you to the General Settings.
1) Facebook app version 3.3.2 that runs on iOS 3.1.3 shows this alert on start. I looked at the three20 source code in git-hub but that project is not really a full source of the app but more of a library with the app's components.
2) GroupMe also shows the same alert when adding current location to a new message.
You mean the settings of the app like you see in settings?
First create a settings.bundle in xcode>newfile>settings.bundle.
This will create some prop lists that you can edit from out of the Settings.app or your app self. For the exact code Google can help you a lot further that I can. If you have any specific questions; don't hesitate to ask.
In iOS 5.0 you can open settings using the "prefs://" URL scheme. But in iOS 5.1 it doesn't work. But there is a trick I used for login twitter account using settings inside my app. the code is
TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc] init];
// Create the completion handler block.
[tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result)
{
[self dismissModalViewControllerAnimated:YES];
}];
// Present the tweet composition view controller modally.
[self presentModalViewController:tweetViewController animated:YES];
tweetViewController.view.hidden = YES;
for (UIView *view in tweetViewController.view.subviews){
[view removeFromSuperview];
}
Using this code you can switch to settings from your app directly if you are not already logged in twitter account.