Navigating from xamarin multi-platform page to iOS or android page
I'm trying to follow this tutorial on creating a login page using Auth0: https://auth0.com/docs/quickstart/native/xamarin/01-login#handing-the-callback-url and noticed that the tutorial creates two separate login pages for android and iOS, as if they are two separate apps/projects/solutions. But my app is supposed to be compatible with both android and iOS, so I created a forms page under RoseySports.ios called Login_iOS (As indicated in screenshot 1) and would like to test it out to see if the login page works, but cannot seem to find a way to set the MainPage as Login_iOS (screenshot 2). I would like for it to be so that if a device is running iOS, it will redirect the user to the iOS version of the login page, and vice versa for android. Sorry if I'm not using the correct terminology when describing my issue. The reason I had to create two separate login pages for iOS and android was because i had to use using Auth0.OidcClient;
as there are separate Nuget packages for the iOS solution and Android solution, which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android).
And please let me know if there's a way to make just one login page for both platforms using Auth0.
UPDATE:
This is what I've done now, but I'm getting an error at MainPage = new RoseySports.Login_iOS();
saying that Login.iOS does not exist in the namespace RoseySports. This is the rest of the code:
`switch(Device.RuntimePlatform)
{
case Device.iOS:
MainPage = new RoseySports.Login_iOS();
break;
case Device.Android:
MainPage = new Login_Page();
break;
}`
visual-studio xamarin xamarin.ios xamarin.android auth0
add a comment |
I'm trying to follow this tutorial on creating a login page using Auth0: https://auth0.com/docs/quickstart/native/xamarin/01-login#handing-the-callback-url and noticed that the tutorial creates two separate login pages for android and iOS, as if they are two separate apps/projects/solutions. But my app is supposed to be compatible with both android and iOS, so I created a forms page under RoseySports.ios called Login_iOS (As indicated in screenshot 1) and would like to test it out to see if the login page works, but cannot seem to find a way to set the MainPage as Login_iOS (screenshot 2). I would like for it to be so that if a device is running iOS, it will redirect the user to the iOS version of the login page, and vice versa for android. Sorry if I'm not using the correct terminology when describing my issue. The reason I had to create two separate login pages for iOS and android was because i had to use using Auth0.OidcClient;
as there are separate Nuget packages for the iOS solution and Android solution, which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android).
And please let me know if there's a way to make just one login page for both platforms using Auth0.
UPDATE:
This is what I've done now, but I'm getting an error at MainPage = new RoseySports.Login_iOS();
saying that Login.iOS does not exist in the namespace RoseySports. This is the rest of the code:
`switch(Device.RuntimePlatform)
{
case Device.iOS:
MainPage = new RoseySports.Login_iOS();
break;
case Device.Android:
MainPage = new Login_Page();
break;
}`
visual-studio xamarin xamarin.ios xamarin.android auth0
there are a lot of different ways to approach this, but you could create a Custom Renderer for LoginPage that would then provide the appropriate platform implementation
– Jason
Nov 20 '18 at 0:56
add a comment |
I'm trying to follow this tutorial on creating a login page using Auth0: https://auth0.com/docs/quickstart/native/xamarin/01-login#handing-the-callback-url and noticed that the tutorial creates two separate login pages for android and iOS, as if they are two separate apps/projects/solutions. But my app is supposed to be compatible with both android and iOS, so I created a forms page under RoseySports.ios called Login_iOS (As indicated in screenshot 1) and would like to test it out to see if the login page works, but cannot seem to find a way to set the MainPage as Login_iOS (screenshot 2). I would like for it to be so that if a device is running iOS, it will redirect the user to the iOS version of the login page, and vice versa for android. Sorry if I'm not using the correct terminology when describing my issue. The reason I had to create two separate login pages for iOS and android was because i had to use using Auth0.OidcClient;
as there are separate Nuget packages for the iOS solution and Android solution, which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android).
And please let me know if there's a way to make just one login page for both platforms using Auth0.
UPDATE:
This is what I've done now, but I'm getting an error at MainPage = new RoseySports.Login_iOS();
saying that Login.iOS does not exist in the namespace RoseySports. This is the rest of the code:
`switch(Device.RuntimePlatform)
{
case Device.iOS:
MainPage = new RoseySports.Login_iOS();
break;
case Device.Android:
MainPage = new Login_Page();
break;
}`
visual-studio xamarin xamarin.ios xamarin.android auth0
I'm trying to follow this tutorial on creating a login page using Auth0: https://auth0.com/docs/quickstart/native/xamarin/01-login#handing-the-callback-url and noticed that the tutorial creates two separate login pages for android and iOS, as if they are two separate apps/projects/solutions. But my app is supposed to be compatible with both android and iOS, so I created a forms page under RoseySports.ios called Login_iOS (As indicated in screenshot 1) and would like to test it out to see if the login page works, but cannot seem to find a way to set the MainPage as Login_iOS (screenshot 2). I would like for it to be so that if a device is running iOS, it will redirect the user to the iOS version of the login page, and vice versa for android. Sorry if I'm not using the correct terminology when describing my issue. The reason I had to create two separate login pages for iOS and android was because i had to use using Auth0.OidcClient;
as there are separate Nuget packages for the iOS solution and Android solution, which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android).
And please let me know if there's a way to make just one login page for both platforms using Auth0.
UPDATE:
This is what I've done now, but I'm getting an error at MainPage = new RoseySports.Login_iOS();
saying that Login.iOS does not exist in the namespace RoseySports. This is the rest of the code:
`switch(Device.RuntimePlatform)
{
case Device.iOS:
MainPage = new RoseySports.Login_iOS();
break;
case Device.Android:
MainPage = new Login_Page();
break;
}`
visual-studio xamarin xamarin.ios xamarin.android auth0
visual-studio xamarin xamarin.ios xamarin.android auth0
edited Nov 21 '18 at 11:02
Mohamed Al Sabbagh
asked Nov 19 '18 at 23:03
Mohamed Al SabbaghMohamed Al Sabbagh
317
317
there are a lot of different ways to approach this, but you could create a Custom Renderer for LoginPage that would then provide the appropriate platform implementation
– Jason
Nov 20 '18 at 0:56
add a comment |
there are a lot of different ways to approach this, but you could create a Custom Renderer for LoginPage that would then provide the appropriate platform implementation
– Jason
Nov 20 '18 at 0:56
there are a lot of different ways to approach this, but you could create a Custom Renderer for LoginPage that would then provide the appropriate platform implementation
– Jason
Nov 20 '18 at 0:56
there are a lot of different ways to approach this, but you could create a Custom Renderer for LoginPage that would then provide the appropriate platform implementation
– Jason
Nov 20 '18 at 0:56
add a comment |
1 Answer
1
active
oldest
votes
You have multiple questions and in StackOverflow you should not ask them in one question, but let's try to address them:
- Pages are only graphic elements and there is no need to implement separate graphic elements in iOS and Android in most cases, and yours doesn't look like a valid one for that
- In general you can implement some code as platform specific. If you are using shared projects you can use conditional compiling, if not then dependency injection
- You can use some of the technics above to do what you wanted to do (have different versions of pages per platform)
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to useusing Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)
– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
Thanks, but I don't think any of them apply. I'm basically looking for what to put forMainPage =
that will call Login_iOS if an iOS device is being used. If I use a#if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution
– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
And for some reason when I try using the#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use//
and doesn't try running it
– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383888%2fnavigating-from-xamarin-multi-platform-page-to-ios-or-android-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have multiple questions and in StackOverflow you should not ask them in one question, but let's try to address them:
- Pages are only graphic elements and there is no need to implement separate graphic elements in iOS and Android in most cases, and yours doesn't look like a valid one for that
- In general you can implement some code as platform specific. If you are using shared projects you can use conditional compiling, if not then dependency injection
- You can use some of the technics above to do what you wanted to do (have different versions of pages per platform)
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to useusing Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)
– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
Thanks, but I don't think any of them apply. I'm basically looking for what to put forMainPage =
that will call Login_iOS if an iOS device is being used. If I use a#if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution
– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
And for some reason when I try using the#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use//
and doesn't try running it
– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
|
show 2 more comments
You have multiple questions and in StackOverflow you should not ask them in one question, but let's try to address them:
- Pages are only graphic elements and there is no need to implement separate graphic elements in iOS and Android in most cases, and yours doesn't look like a valid one for that
- In general you can implement some code as platform specific. If you are using shared projects you can use conditional compiling, if not then dependency injection
- You can use some of the technics above to do what you wanted to do (have different versions of pages per platform)
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to useusing Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)
– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
Thanks, but I don't think any of them apply. I'm basically looking for what to put forMainPage =
that will call Login_iOS if an iOS device is being used. If I use a#if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution
– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
And for some reason when I try using the#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use//
and doesn't try running it
– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
|
show 2 more comments
You have multiple questions and in StackOverflow you should not ask them in one question, but let's try to address them:
- Pages are only graphic elements and there is no need to implement separate graphic elements in iOS and Android in most cases, and yours doesn't look like a valid one for that
- In general you can implement some code as platform specific. If you are using shared projects you can use conditional compiling, if not then dependency injection
- You can use some of the technics above to do what you wanted to do (have different versions of pages per platform)
You have multiple questions and in StackOverflow you should not ask them in one question, but let's try to address them:
- Pages are only graphic elements and there is no need to implement separate graphic elements in iOS and Android in most cases, and yours doesn't look like a valid one for that
- In general you can implement some code as platform specific. If you are using shared projects you can use conditional compiling, if not then dependency injection
- You can use some of the technics above to do what you wanted to do (have different versions of pages per platform)
edited Nov 20 '18 at 9:04
answered Nov 19 '18 at 23:41


Ivan IčinIvan Ičin
3,70442343
3,70442343
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to useusing Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)
– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
Thanks, but I don't think any of them apply. I'm basically looking for what to put forMainPage =
that will call Login_iOS if an iOS device is being used. If I use a#if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution
– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
And for some reason when I try using the#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use//
and doesn't try running it
– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
|
show 2 more comments
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to useusing Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)
– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
Thanks, but I don't think any of them apply. I'm basically looking for what to put forMainPage =
that will call Login_iOS if an iOS device is being used. If I use a#if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution
– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
And for some reason when I try using the#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use//
and doesn't try running it
– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to use
using Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
Sorry if my wording is off, I meant for the question to just be how to switch the MainPage to the Login_iOS page, and vice versa for when using Android. And I forgot to mention, the reason I had to create two separate login pages for iOS and android was because i had to use
using Auth0.OidcClient;
which doesn't work when trying to put it on the main project (the one compatible for both iOS and Android)– Mohamed Al Sabbagh
Nov 20 '18 at 0:08
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
and could you please explain what you mean by your last point? ("Also you may create a LoginPage property...")
– Mohamed Al Sabbagh
Nov 20 '18 at 0:12
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
I've updated the answer to include a new link. All you need to know is in those linked articles. I am not sure which one you should apply it depends on how did you set up your project.
– Ivan Ičin
Nov 20 '18 at 0:29
Thanks, but I don't think any of them apply. I'm basically looking for what to put for
MainPage =
that will call Login_iOS if an iOS device is being used. If I use a #if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
Thanks, but I don't think any of them apply. I'm basically looking for what to put for
MainPage =
that will call Login_iOS if an iOS device is being used. If I use a #if __IOS__
, i still don't know what to put for MainPage as I don't know how to navigate it to the iOS section of the solution– Mohamed Al Sabbagh
Nov 20 '18 at 7:24
And for some reason when I try using the
#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use //
and doesn't try running it– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
And for some reason when I try using the
#if __IOS__
in app.xaml.cs it makes the code I use under it turn dark green, as a note, like when you use //
and doesn't try running it– Mohamed Al Sabbagh
Nov 20 '18 at 7:36
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53383888%2fnavigating-from-xamarin-multi-platform-page-to-ios-or-android-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
there are a lot of different ways to approach this, but you could create a Custom Renderer for LoginPage that would then provide the appropriate platform implementation
– Jason
Nov 20 '18 at 0:56