Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
291 Cards in this Set
- Front
- Back
True/False? Linear Layouts require a layout_width and layout_height to be set. |
True |
|
Which one is not deprecated? Match Parent Fill Parent |
Match Parent |
|
What is the preferred unit when laying out android stuff? |
density-independent pixel (dp) |
|
How many physical pixels (px) would a 100 dp button occupy on a 480dpi screen? |
160 dpi is the baseline (same as G1) 480/160 = 3 3 * 100 = 300 |
|
How do you designate the main activity in an app? |
Use an attribute on the class
[Activity(MainLauncher = true)] public class PiActivity : Activity { ... } |
|
How do you create an ID for a view in Android? |
in the layout file, specify @+id/ViewName |
|
In android, how do you get the ID of a view to use in code? |
var blah = FindViewById(Resource.Id.ViewName); |
|
T/F: Xamarin provides wrappers for all of Mono.NET library |
False - It provides wrappers for most types, but not the whole library. |
|
In the folder structure, where do you place the layout files? |
In the layout folder |
|
What are the 3 types of layouts? |
Linear, relative, and grid. |
|
which one of these is not used? Mono base class library, mono class library, mono runtime, or C# compiler? |
Mono class library |
|
In Xamarin.Android, what does the linker do? |
It removes unused IL code in the mono assemblies and your assemblies to give you a smaller package. If you are using dynamic code (eg members accessed via reflection) you should turn the linker off. |
|
Which items do you need to have installed to develop Xamarin.Androidapps? a) JDK(JavaSDK) b) Android SDK c) Mono.NET d) Alloftheabove |
D |
|
Xamarin.Android compiles your C# to Java bytecodes in order to execute iton the Android Runtime (ART)? a) True b) False |
false |
|
What base class do Activity classes inherit from? |
Context
|
|
What method do you call to launch a new activity? |
base.StartActivity(intent); |
|
You can think of a Context as representing _______________? a) Your app b) The Android OS running your app c) The other apps installed on the device |
B |
|
What is an explicit Intent? a) An Intent that targets an Activity built-in to the Android OS b) An Intent that targets an Activity in the same .apk c) An Intent that exactly identifies the target Activity |
C |
|
What is a bundle? |
A collection of key/value pairs passed between Activities. |
|
T/F Objects must be serializable to be passed in a bundle. |
True |
|
What are the 2 ways to serialize complex objects to/from a bundle? |
IParcelable and ISerializable |
|
What are intent extras? |
That's where you put bundles |
|
How do you pass arguments to an Activity? a) You can't pass them directly, you need to upload the data to your server and then download them in the target Activity b) In a Bundle inside an Intent c) Add a URL-style query string to the target Activity name |
b |
|
Which of the following can you pass between Activities? a) Simple types like integers, strings, etc. b) Serialized objects c) Object references |
A and B |
|
What method do you used when you want to pass data back to a calling activity? |
StartActivityForResult(Intent intent, int requestCode); Set the ResultCode before returning to the calling Activity. Can add a bundle to the SetResult method. |
|
What is the name of the method that gets called on the parent activity after the child activity calls SetResult and then returns back to the parent? |
OnActivityResult |
|
What is an implicit intent? |
It describes what you want done without specifying which activity should do it. |
|
What is an intent action? |
It specifies the work you want done. eg dial the phone, send a message, display some info |
|
What is intent data? |
A single piece of data for use by the target activity. eg map coordinates, phone number (tel:(616) 555-1212) |
|
What is the mime type? |
The MIME Type indicates the type of the Data you want the Intent tomanipulate, it helps Android determine which Activity to launch. Insert a new contact vnd.android.cursor.dir/contact Add a calendar event vnd.android.cursor.dir/event |
|
What is the category? |
A Category restricts the kind of Activity you would like to handle yourIntent. eg Preferences, Tab, Openable |
|
You can add code to monitor network connections directly in a SharedProject or Portable Class Library (True or False)? a) True b) False |
False because it is done differently per platform. |
|
To determine if an iOS device is roaming, you need to: a) Check the IsRoaming property on the ConnectivityManager b) Subscribe to the ReachabilityChanged event c) You cannot detect roaming conditions on iOS |
C |
|
You can obtain network information about an Android device using themethod call: a) Android.GetNetworkInformation b) ConnectivityManager.ActiveNetworkInfo c) ConnectivityManager.GetNetworkType |
B |
|
Which of the following are safe http calls (do not modify data): A. Options B. Head C. Post D. Patch |
A, B |
|
Which of the following are idempotent (can be called multiple times with same data and produce same result on the server side. A. Options B. Put C. Post D. Patch E. Delete |
A, B, E
|
|
What HTTP verb should be used to update an existing record? a) GET b) POST c) PUT d) UPDATE |
c |
|
One advantage of REST is that many operations are cacheable a) True b) False |
A. All the "safe" operations are cacheable. |
|
Which of these choices would potentially be valid to retrieve a resourcewith an id of "1" and a type of "fruit"? a) GET www.store.com/api/food/1 b) GET www.store.com/api/food/fruit?id=1 c) GET www.store.com/api/food/fruit d) POST www.store.com/api/food e) All of the above are possible |
A, B, C |
|
A UIView is responsible for: a) Event publishing b) Visualization c) Managing subviews d) All of the above e) None of the above |
d |
|
Auto Layout _____________ a) Is only available in the Designer b) Describes relationships between visual elements c) Must be used and cannot be turned off |
b |
|
Spacing constraints are used to position a viewa) True b) False |
true |
|
Classes that will be instantiated by iOS need to have which attribute? |
[Register ("TodoListViewController") |
|
The .designer.cs file a) Is for coding a view’s behavior b) Is a representation of the storyboard in codec) All of the aboved) None of the above |
b |
|
What method do you call to show a ViewController? |
PresentViewController. First tell the Storyboard to instantiate it (InstantiateViewController("ControllerName"), then call PresentViewController. |
|
How do you go back to the previous view controller? |
call this.DismissViewController |
|
True/False. You can use PrepareForSegue to pass data to a target screen? |
True |
|
The UITableViewDelegate is used to ___________ a. handleconvertingrawdataintovisualcells b. provideatype-safecallbacktotheTableView c. handle events and notifications from the TableView d. All of the above |
C |
|
You can implement the data source and delegate ________ a. as separate classes: UITableViewDataSource and UITableViewDelegate b. as asingle class–UITableViewSource c. by overriding methods on UITableViewController directly d. All of the above |
d |
|
Which 2 methods must be implemented in UITableView? |
GetCell and RowsInSection |
|
Which protocol provides a mechanism for interacting with with a TableView? |
UITableViewDelegate |
|
Which method is called when a user taps a row? |
RowSelected |
|
The GetCell method is used to _____________ a) create sections in the table b)return an int count of the total number of rows the table should display c) return a UITableViewCell populated with data for the correspondingrow index passed to the method |
c |
|
Displaying hundreds, or even thousands of rows of data in a Table View requiresthe code to __________________ (select all that apply) a)Register a reuseidentifier foreach unique celltype b) use a customDictionary<> c) always use DequeueReusableCell d) set all the UITableViewCellsub-viewproperties in GetCell andrepopulate them in case of cell reuse |
A, C, D |
|
What method do you call on the Navigation controller to show a new screen? |
navController.PushViewController(newViewController, bool Animated) |
|
How do you programmatically go back to the previous screen? |
navController.PopViewController(animated true) |
|
How do you change the behavior or appearance of the navigation controller? |
Use the navigationItem property. |
|
How do you instantiate a ViewController that is defined in a Storyboard? |
UIViewController controller = ...; var sb = controller.Storyboard; var newVC = sb.InstantiateViewController ("myViewController");controller.PushViewController (newVC, controller); |
|
Tabbar navigation is ideal for how many screens? |
3 to 5 of equal importance. |
|
How do you create a tabbar from code? |
instantiate a ViewController. Create a TabBarItem for the ViewController and pass in an icon and text to display. Set the TabBarItem property of the ViewController to the TabBarItem. In the TabBarViewController, set the ViewControllers property to an array of the ViewControllers that you instantiated. |
|
How do you create a master/detail view? |
UISplitViewController
|
|
UISplitView is limited to how many navigation levels? |
2 |
|
Which method would you use to replace the Master view for aUISplitViewController? a) PushViewController b) PresentModalViewController c) ShowViewController |
C |
|
A UISplitViewController can push multiple levels of navigationand acts exactly like a UINavigationController on an iPhone a) True b) False |
B |
|
To assign child pages to a UIPageViewController, we can ______(choose all that apply) a) assigntheViewControllersproperty b) assignthePageViewControllersproperty c) calltheAddPagemethod d) assignaUIPageViewDataSource |
A, D |
|
When using the designer, we can assign child pages to a Page ViewController using the PageViewSegue a) True b) False |
B |
|
What are iOS Backgrounding options? |
Finite - any code but limited long-running only specific tasks not time limited background transfers - data transfer, not limited |
|
Which iOS background technique should you use to transfer thecontents of a catalogue of a shopping app in order to support offlineusage? a) Finite-Length Task b) Background Transfer c) Long-Running Task |
B |
|
Which iOS background technique should you use to encrypt and storeuser settings when the app gets backgrounded? a) Finite-Length Task b) Background Download c) Long-Running Task |
a |
|
Which iOS background technique should you use to track the device’scurrent location? a) Finite-Length Task b) Background Download c) Long-Running Task |
c |
|
What methods are called when transitioning to/from background state? |
WillEnterForeGround and DidEnterBackground |
|
How long does DidEnterBackground get to return? |
Around 5 seconds. One way to extend time is to use a FiniteLengthTask |
|
Under which conditions must you end a finite length task? |
App moves to foreground, the task completes, or the task expires. |
|
The remaining time available for a Finite-Length Task to finish is always______. a) 10 minutes b) 3 minutes c) different d) available through UIApplication.BackgroundTimeRemainingproperty |
d |
|
Calling UIApplication.BeginBackgroundTask(OnDone) [select all that apply] a) starts a thread and executes OnDone() asynchronously b) signals the operating system that it should not suspend currently running threads when backgrounded c) triggers OnDone() if the available time for background operations isabout to expire |
B, C |
|
How are the rows in a ListView created? a) TheListView creates them using a DataTemplate b) The ListView asks the Adapter for each row as needed c) Rows are always strings so there is no need to create them |
B |
|
What is ArrayAdapter's key limitation? a) Dataobjectsmustbeinanarrayb) The rows it builds do not support ItemClickevents c) It can only populate one TextView |
c |
|
How does ArrayAdapter convert the code-behind data into a string? a) Calls ToString b) Serializestheobject to XML c) Uses reflection to get the first string property in the object |
a |
|
ViewHolder must inherit from what class? |
Java.Lang.Obj |
|
What is the View Holder pattern? |
Used to hold strong references to your view instead of findViewByID. When you create a ViewHolder class with cached version of the image, text, etc of the view and attach it to the Tag property of the View. |
|
Which ListView event is raised when the user clicks on a row? a) Click b) ItemClick c) ItemSelected |
B |
|
What is inflation? a) Populating a list with rows b) Creating a Drawable from an Asset file c) Loading code-behind data into the views of a row d) Creating a view hierarchy from a layout file |
d |
|
If you implement the view-holder pattern correctly, how many times willyou use FindViewById to locate each view in a row's view hierarchy? a) 0 b) 1 c) 2 |
b |
|
To provide indexing, you implement ISectionIndexer on which class? a) The ListView itself b) Your custom Adapter c) YourMainActivity |
B |
|
GetSectionForPosition maps indices from ____________ a) list position to section index b) section index to list position c) view position to listposition |
a |
|
What is a framelayout? |
Essentially it is a container that allows you to swap out the contents on the fly. |
|
Which term describes the common use of FrameLayout? a) Placeholder b) Root c) Border |
a |
|
A Fragment is bigger than an Activity. a) True b) False |
False. A fragment is held inside an activity. |
|
What is a view pager? |
ViewPager is a layout manager that lets the user step forward and back through a sequences of pages |
|
ViewPager handles replacing your fragments (transactions, etc) for you automatically? a) True b) False |
True
|
|
Activities that host aViewPageruse the support-libraryFragmentActivityclass as their base a) True b) False |
True |
|
ActionBar is only available in the latest version of Android. a) True b) False |
B. It's supported all the way back to Android 2.1 |
|
What do you do to be notified of ActionBar item-clicks? a) Subscribe to the ActionBar.ItemClick event b) Pass an Action to the ActionBar constructor c) Override an Activity method |
C. Override OnOptionsItemSelected |
|
DrawerLayout is a layout manager that provides a flyout menu a) True b) False |
a |
|
You instantiate an ActionBarToggleButton in code, not XML a) True b) False |
A |
|
What are the 2 accessibility strings required by the ActionBarToggleButton? |
DrawerOpenDescription and DrawerCloseDescription |
|
ActionBarDrawerToggle and DrawerLayout have references to each other so that they can work together a) True b False |
True. This is so that if you open or close the drawer in one class, the other will know and can react accordingly (eg open the drawer with swipe the ActionBarDrawerToggle button can update its icon) |
|
How do you configure a gesture recognizer so that it doesn't prevent built in gestures from firing? |
tapGesture.Recognizer.CancelsTouchesInView = false; |
|
What is a discrete gesture? |
It only fires the first time the gesture is recognized. |
|
When should you use a MapView vs MapFragment? |
MapView should be used if your app is comprised of fragments. MapFragment should be used if you are going to put the map class inside an activity. |
|
You must do all of the google maps work on the UI thread? a) True b) False |
a |
|
How can you ensure there is a map application present? a) StartActivity b) ActionView c) ResolveActivity() d) Android.Net.Uri.Parse() |
c |
|
What optional component must be included in the Android SDKManager? a) Google Play Services b) Android Support Repository c) Google Repository d) Google Play Licensing Library |
a |
|
Which emulator images have Play Services pre-installed? a) Android SDK Build-tools b) Google APIs (x86 System Image) c) Google APIs (ARM System Image) d) SDK Platform |
b,c |
|
You can use the same API key on more than one development machine(True or False)? a) True b) False |
a |
|
How does Google Play Services authenticate your application? a) Shared password b) API key + SHA1 keystore fingerprint + package name c) X.509certificate d) No authentication necessary |
b |
|
Which permissions must be added to the Android manifest? (Select allthat apply) a) INTERNET b) ACCESS_NETWORK_STATE c) ACCESS_FINE_LOCATION d) WRITE_EXTERNAL_STORAGE |
a,b,d |
|
What classes are used to add the map visualization into the UI screen? a) MapView b) MapFragment c) GoogleMap d) Both A and B |
d |
|
Which class should be used to host a map in a fragment? a) OnCreateView b) MapFragment c) FindViewByID d) MapView |
d |
|
Google Maps raises the InfoWindowClick event when the user tapson a displayed info window popup for a marker. a) True b) False |
a |
|
What does the CameraPosition identify? a) Tilt b) Zoom c) Target d) All the above |
d |
|
What class do you use to create an update request? a) CameraUpdateFactory b) CameraUpdate c) CameraPosition d) None of the above |
a |
|
Android lifecycle: Running Paused Backgrounded - Remains active in memory Stopped - Removed from memory when the user presses the back button or android runs out of memory |
Yep |
|
Lifecycle methods: OnCreate() OnStart() OnResume() OnPause() OnStop() - activity is backgrounded. Either go to OnRestart or OnDestroy next OnDestroy() - Activity is stopped |
Yes |
|
What method do you call to start a service? |
context.StartService(new Intent(this, typeof(MyService))); |
|
Types of services |
Started - manually started Bound - started on demand Hybrid - started + bound |
|
Started Service lifecycle |
Call to StartService() OnCreate() OnStartCommand() - Service is now running OnDestroy() |
|
Bound Service lifecycle |
Call to BindService() Service running? No, call OnCreate() Yes, OnBind() - Service running Call to UnbindService() OnUnbind() All clients unbound? No goes to Service Running Yes - OnDestroy() |
|
Android activity lifecycle |
OnCreate() OnStart() OnResume() OnPause() - Goes back to OnResume() OnStop() OnRestart() - Goes back to OnStart() OnDestroy() |
|
How much code is typically shared or platform specific? |
iOS - 70% shared, 30% platform Android - 86% shared, 14% platform WinMo - 85% shared, 15% platform |
|
The main thing that makes code sharable across platform is _______ a) When it is related to I/O b) When it comes from Nuget c) When it does not depend on anything platform APIs d) All of the above |
c |
|
Which of the following might be possible candidates for sharing? a) Code that accesses a Web Service accessing HttpClient b) Validation rules for my UI which uses Regex and return bools c) Code that uses local notifications on the device d) Code that runs an algorithm to compare flight prices in parallel |
a,b,d |
|
Platform Specific Code Strategies |
Conditional Compilation Class Mirroring Partial Classes + Methods |
|
Class Mirroring |
Basically uses dependency injection (DI) to figure out which class/method to call at runtime. |
|
What types of files can you add to a Shared Project? a) Source Code only b) Source and Image assets c) Source and Data files d) Anything supported by the targets using the project |
d |
|
In PCL's, what are the 3 methods for using platform specific code? |
Callbacks, factories, and DI |
|
Event based |
Call an event whenever you want platform specific code executed. |
|
Shared Project Pros and cons |
Pros: All APIs available Platform-specific logic can be added directly All file types can be shared Cons: Can lead to spaghetti code Cannot be united tested on its own Must be shipped in source form |
|
Portable Class Libraries Pros and cons |
Pros: Enforces architectural design Can be unit tested on its own Can be shipped in binary form (Nuget) Cons: Limited APIs available Difficult to share non-code files Requires more work to integrate platform specific code |
|
Which of the following is not a platform supported by PCLs. a) .NET2.0 b) Windows Phone 8.0 (Silverlight) c) Windows Phone 8.1 d) Windows Store Apps |
a |
|
For Xamarin Forms, a Page represents a screen and a View is a control. a) True b) False |
a |
|
You must call _________ before using Xamarin.Forms a) Forms.Initialize b) Forms.Init c) Forms.Setup d) No setup call necessary. |
b |
|
To supply the initial page for the application, you must set the _______property. a) Application.FirstPage b) Application.PrimaryPage c) Application.MainPage d) Application.MainView |
c |
|
The direction (left-to-right or top-to-bottom) a StackLayoutorganizes content is controlled by which property? a) Style b) Direction c) Orientation d) LayoutDirection |
c |
|
Which of these controls is not available in Xamarin.Forms? a) Button b) DatePicker c) ListBox d) ListView |
c |
|
To adjust spacing between children when using the StackLayoutcontainer we can change the ______ property. a) Margin b) Padding c) Spacing |
c |
|
Padding is the amount of space between the views and the edges of the page a)True b)False |
a |
|
What platform-specific features does Xamarin Forms have built-in? |
Devic.OpenUri Alert Messages (Page.DisplayAlert) Timer (Device.StartTimer) UI Thread marshaling (Device.BeginInvokeOnMainThread) Mapping (Xamarin.Forms.Maps) |
|
What type of dependency injection (DI) does Xamarin.Forms provide? |
Service locator |
|
How do you specify a dependency in Xamarin.Forms? |
[assembly: Dependency(typeof(PhoneDialerIos))] |
|
How do you get an instance of a service using DI in Xamarin.Forms? |
IDialer dialer = DependencyService.Get(); if (dialer != null) { ... } |
|
How do you check for network status on Android? |
ConnectivityManager connectivityManager = (ConnectivityManager) Application.Context.GetSystemService(Context.ConnectivityService); bool isConnected = connectivityManager.ActiveNetworkInfo != null&& connectivityManager.ActiveNetworkInfo.IsConnected; |
|
How do you check network status on iOS? |
bool isConnected = Reachability.InternetConnectionStatus()!= NetworkStatus.NotReachable |
|
How do you check if the network is reachable in Windows phone (WP)? |
bool isConnected = DeviceNetworkInformation.IsNetworkAvailable; |
|
How do you monitor if the network goes down in Android? |
Subscribe to the BroadcastReceiver ConnectivityChangeReceiver android.net.conn.CONNECTIVITY_CHANGE |
|
How do you monitor if the network goes down in iOS? |
Reachability.ReachabilityChanged += (sender, args) => isConnected = Reachability.InternetConnectionStatus() != NetworkStatus.NotReachable |
|
How do you monitor network changes on Windows Phone (WP)? |
DeviceNetworkInformation.NetworkAvailabilityChanged +=(sender, e) => isConnected = e.NetworkInterface.InterfaceState == ConnectState.Connected; ... NetworkChange.NetworkAddressChanged += (sender, e) =>isConnected = DeviceNetworkInformation.IsNetworkAvailable; |
|
How do you determine the network type on Android? |
NetworkInfo netInfo = connectivityManager.ActiveNetworkInfo; ConnectivityType currentNetworkType = netInfo.Type; if (currentNetworkType == ConnectivityType.Wifi) {... } else if (currentNetworkType == ConnectivityType.Mobile) {... } |
|
How do you determine the network type on iOS? |
var status = Reachability.InternetConnectionStatus();NetworkType currentNetworkType = (status == NetworkStatus.ReachableViaWiFiNetwork)? NetworkType.Wifi: (status == NetworkStatus.ReachableViaCarrierDataNetwork ? NetworkType.Cellular : NetworkType.None; |
|
How do you determine the network type on Windows Phone (WP)? |
NetworkInterfaceInfo networkInterfaceInfo = new NetworkInterfaceList().FirstOrDefault(n => n.InterfaceState == ConnectState.Connected); NetworkType networkType = NetworkType.None;if (networkInterfaceInfo != null && networkInterfaceInfo.InterfaceType == NetworkInterfaceType.Wireless80211){ networkType = NetworkType.Wifi;} |
|
You can detect roamin on Android and Windows Phone (WP), but it is platform specific. |
True |
|
How do you detect roaming on Android? |
ConnectivityManager connectivityManager =(ConnectivityManager)Application.Context .GetSystemService(Context.ConnectivityService); bool isRoaming = (connectivityManager != null &&connectivityManager.ActiveNetworkInfo.IsRoaming); |
|
How do you detect roaming on Windows Phone (WP)? |
bool isRoaming = DeviceNetworkInformation.IsCellularDataRoamingEnabled; |
|
Is there a nuget package for cross-platform network detection? |
Yes. github.com/jamesmontemagno/Xamarin.Plugins |
|
POST is used to create resources when the service decides the location |
True |
|
PUT is used to update or create resources when the ID is passed in |
True |
|
Safe HTTP methods do not modify that resource representation. They allow for proxy caching etc for faster performance. |
OPTIONS yes GET yes PUT no DELETE no HEAD yes POST no PATCH no |
|
Idempotent HTTP methods can becalled multiple times with the samedata and it will always produce thesame result on the server (e.g. noside effects) |
OPTIONS yes HEAD yes POST no PATCH no |
|
Pay attention to status codes andreissue requests to idempotent andsafe operations when outcome isuncertain (timeout, etc.) |
True |
|
HttpClient is supported in .NET, Android, and iOS apps natively. To use it in Windows Phone (WP), you need to install a Nuget package. |
True |
|
What are some HttpClient Get methods? |
GetStringAsync - returns the body GetStreamAsync GetByteArrayAsync GetAsync - returns full HttpResponseMessage which includes headers + body+ status |
|
System.Json is not supported in PCLs Json.NET is. |
True |
|
REST is an architectural style based on the architecture of _________ a) HTTP and XML b) TCP/IP networking c) The World Wide Web (WWW) d) None of the above |
c |
|
Typically you use HttpClient to communicate with a REST based web service. |
True |
|
HttpClient is not as efficient as the native iOS and Android networking libraries. |
True |
|
ModernHttpClient is a Nuget package that works on iOS and Android. It has a different implementation for iOS and Android which gives you performance improvements. |
True |
|
In iOS 9, Apple created App Transport Security (ATS). It requires TLS 1.2 or better. You must use a cipher algorithm that provides forward security and certificates must be signed with SHA256, 2048-bit RSA key or better. It is enforced anytime you rely on underlying iOS networking, which ModernHttpClient does. |
True |
|
If you have an ATS problem, you will most likely get an exception that the connection is a non-TLS endpoint. |
True |
|
You can add NSAppTransportSecurity to your info.plist to get around ATS. You can also disable ATS by default. |
True NSAppTransportSecurity NSAllowsArbitraryLoads |
|
SOAP used HttpPost command |
True |
|
Using WCF with Xamarin requires a business edition license and a windows machine with the Silverlight SDK. |
True |
|
When using WCF, client and server have to agree on ABC's - Address, Binding, and Contract. Contract is typically an Interface. |
True |
|
User preferences are good for storing app configuration and other things that the user can control. |
True |
|
All 3 platforms support text, binary, XML and JSON file formats |
True |
|
For Android, the file location path is /files. To get it, use Environment.GetFolderPath(Environment.SpecialFolder.Personal); |
True |
|
For iOS, the file location path is /Library/[subdirectory]. var docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); libFolder = Path.Combine(docFolder, "..", "Library"); |
True |
|
For Windows Phone (WP), the location path is \local Windows.Storage.ApplicationData.Current.LocalFolder.Path; |
True |
|
How do you specify a file not be backed up by iCloud? |
void AddSkipBackupAttribute(string filename) { if (File.Exists(filename)) {// Do not backup to iCloud NSFileManager.SetSkipBackupAttribute(filename, true); } } |
|
On iOS, the documents folder is backed up by default. |
True |
|
In iOS, the library folder is where you store files that are not created by the user (database, etc). This folder is never exposed to the user in iTunes. It IS backed up. |
True |
|
SQLite is built into Android and iOS, but NOT Windows Phone. |
True |
|
When installing SQLite for Windows Phone (WP), you need to add a reference to Visual C++ runtime. |
True |
|
SQLite.net is probably the best SQLite API to use. It supports iOS, Android, Windows Phone (WP) 8, and WinStore. It's stable. ADO.NET is considered legacy. Install the one by Frank Krueger |
True |
|
How do connect to a SQLite db? |
string filename = ... SQLiteConnection conn = new SQLiteConnection(filename); |
|
SQLite db file goes where?
|
Android: Path.Combine(personalFolder, "databases") /databases iOS: Path.Combine(personalFolder, "..", "Library) /Library WinPhone: ApplicationData.Current.LocalFolder.Path \local |
|
For SQLite DB, it's better to use the same connection for a set of operations vs opening a new one each time. |
True |
|
How do you map a class to a table? |
[Table("people")] public class Person{ // PrimaryKey must be numeric [PrimaryKey, AutoIncrement,Column("_id")] public int Id { get; set; } [MaxLength(250), Unique] public string Name { get; set; } |
|
With SQLite, how do you create a table? |
SQLiteConnection conn; ... conn.CreateTable(); |
|
How do you create an entity in SQLite? |
int result = conn.Insert(person); return result; It returns the number of rows affected. |
|
How do you get records from SQLite? |
List people = conn.Table().ToList(); return people; |
|
SQLite can only have one outstanding operation at a time. If you want to use a connection with multiple thread, you must guard access with a lock. |
public int AddNewPerson(Person person) { lock (guard) { return dbConn.Insert(person); } } |
|
With SQLite, how do you create a table asynchronously? |
var conn = new SQLiteAsyncConnection(dbPath);... await dbConn.CreateTableAsync(); |
|
With SQLite, how do you asynchronously query the db? |
List people = await dbConn.Table().ToListAsync(); // Must be on UI thread here! foreach (var p in people) peopleList.Add(p); |
|
With SQLite, how do you run code in a transaction? |
int count = 0; await conn.RunInTransactionAsync(iconn => { count += iconn.Insert(insertMe); count += iconn.Update(updateMe) }); return count; |
|
With SQLite, how do you execute a raw SQL query? |
List students = await conn.QueryAsync( "SELECT * FROM [students] WHERE id in " +"(SELECT sid FROM students_classes WHERE cid=?)", xam160.Id); |
|
With SQLite, how do you stay on the background thread after executing a query? |
Use ConfigureAwait(false) var students = await dbConn.QueryAsync("...", class.Id).ConfigureAwait(false); // Background thread continues execution here .. NOT ON UI THREAD! foreach (var s in students) { ... } |
|
Registration fees for iOS? |
iOS: $99 / $299 annual. Unlimited number of apps. 20% of market. Higher daily revenue.
Android: $25, unlimited, 75% of market. Best searching, new apps found quickly. WinMo: $19-$99 one-time. 100 free app listings. Less competition = more opportunity |
|
"Link SDK Assemblies only" will reduce the size of your app by discarding unused assemblies, types, and members. Sometimes this will remove stuff you need, so make sure you test it. |
True |
|
On iOS, always use the Unified API to support 64-bit, it is required by Apple. |
True |
|
Can bundle ARMv7 and ARM65 in a single app bundle. |
True |
|
Recommended to use LLVM and SGen garbage collector for better runtime performance. |
True |
|
Android deploy settings depend on which license type of Xamarin you have. |
Enterprise - allows you to embed managed code into navtive shared library ProGurad for obfuscating and shrinking java bytecode. Business - AOT performs JIT when app is installed vs when it is run. LLVM - generates smaller, faster code. |
|
It is an Apple requirement to build against the latest SDK. |
True |
|
On iOS, deployment target is the lowest version of iOS that you support. |
True |
|
Info.plist stores icons, launch images, and identifies the launch screen for iOS8. |
True |
|
A startup screen can be definined in a storyboard or xib and use auto layout to automatically resize an image. That way you only need 1 definition. |
True |
|
Retina displays use @2x images and plus phones use @3x. |
true |
|
3 publishing methods for iOS - adhoc, AppStore, and Enterprise. |
True |
|
AdHoc allows for up to 100 devices per year to be used. App is installed directly on the device. Invite by email.TestFlight automates the process for iOS8 and above. |
True |
|
Enterprise is for large companies to distribute apps in-house either through iTunes or OTA from your own servers. Must have enterprise level account and meet Apple requirements. App certificate expires after some time and must be re-signed to continue distribution. |
True |
|
For AppStore, you need to do these things: Generate a distribution cert, generate a provisioning profile, create an AppID, assign identify and sign app with certs, and generate package and upload to iTunes Connect or distribute ipa as enterprise app. |
True |
|
On iOS, the developer certificate is need to sign debug versions of your app that you want to test on physical devices. You need it to deploy locally to a device you own. |
True |
|
Push Notifications Cert is needed to communicate with Apple's test servers. Only to be used for testing. |
True |
|
AppStore/AdHoc Cert - The primary cert. It is needed to sign the app and identify it as trusted by any device (since it comes from Apple) |
True |
|
You also need different production certificated for each unique Apple server-side service you use. Eg Safari Push notifications, VOIP, Apple Pay, Passbook. |
True |
|
The Provisioning Profile is used to glue all the pieces together – itassociates a distribution certificate, an App ID, and a set of device IDsand indicates where the application signed with this certificate can run –there are four types of provisioning profiles you can create: |
True |
|
iOS App developer provisioning profile is used to install apps on local developer devices, devices must be registered. |
True |
|
AdHoc provisioning profile type is used to install apps on specific test users devices (limited). |
True |
|
AppStore provisioning profile type has no device restrictions - deployed through the AppStore and can only be created by the team agent or admin |
True |
|
Enterprise provisioning profile type has no device restrictions. It's deployed through internal corporate delivery, typically OTA and can only be created by the agent/admin. |
True |
|
With Apple TestFlight, you can invite internal and external users to test the app. The system will automatically track the UUID of the device and generate the cert. |
True |
|
HockeyApp is a Microsoft testing distribution platform which supports all major mobile platforms. No forced approval process like TestFlight, can invite testers through email, limited to 100 devices per app, and supports analytics with optional SDK. |
True |
|
In Android, the target should be the latest framework but the min version should be the lowest version the app supports. |
True |
|
In Android, package name must be lowercase. |
True |
|
MDPI - 1x 48px HDPI - 1.5x 72px XHDPI - 2x 96px XXHDPI 3x 144px XXXHDPI 4x 192px |
True |
|
On Android, the keystore is a private key cert used to sign your application and identify you as the publisher. |
True |
|
In android, there are 2 publishing methods - sideloading and Store publishing, |
True |
|
Amazon AppStore developer accounts are free. |
True |
|
Xamarin.Forms targets WP8 SL |
True |
|
For publishing a Windows Phone (WP) app, fill in the WPAppManifest.xml file. |
True |
|
For Windows Phone (WP), the tile icons you need are Normal (300x300), small (159x159), and Wide (691x336). |
True |
|
For Windows Phone (WP), you must have 1 screenshot and localized description for every supported language. You must also support light and dark themes. |
True |
|
Verify your Windows Phone (WP) app with the "Windows Phone Store Test Kit" prior to submission. |
True |
|
On Windows Phone (WP), you can do beta publication on up to 10,000 specific devices. You invite by email. |
True |
|
Another publishing model for Windows Phone (WP) is to submit to the marketplace but hidden. Only people that have the URL can install it. (Targeted App Distribution) |
True |
|
dev.windows.com is the developer portal. Can use the same account for Windows Phone (WP) and Windows Store Apps. |
True |
|
Microsoft supports an enterprise cert which is tied to a company and used to sign internal XAPs. Requires some command-line finesse to create a signed XAP. Companies can create a "Company Hub" app for internal app discovery and installation. |
True |
|
UriImageSource also supports caching of downloaded images, configured through the following properties:CachingEnabled - Whether caching is enabled ( true by default). CacheValidity - A TimeSpan that defines how long the image will be stored locally. Caching is enabled by default and will store the image locally for 24 hours. To disable caching for a particular image, instantiate the image source like this: |
True |
|
How to launch maps app in iOS? |
UIApplication.SharedApplication.OpenUrl(new NSUrl("http://maps.apple.com/?address=1,Infinite+Loop,Cupertin,California")); |
|
How to create a map view using mapkit through code? |
MKMapView map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); |
|
What are the different iOS map styles available? |
Standard, Satellite, Hybrid, and Flyover (iOS9+) & Hybrid Flyover. |
|
CoreLocation is Apple's framework that providescoordinate-based information by retrieving locationand heading data from the iOS device hardware |
True |
|
CLLocationManager is the central pointfor location services in CoreLocation § Current location§ Monitor location changes§ Monitor heading changes (compass)§ Geofencing support§ Beacon regions (BLE) v Often used with MapKit, but can be usedindependently |
True |
|
How to use location manager directly? |
lm = new CLLocationManager { DesiredAccuracy = 1000 } ; |
|
void OnLocationChanged(object sender, CLLocationsUpdatedEventArgs e) { CLLocation newLocation = e.Locations[e.Locations.Length - 1]; UpdateUI(newLocation); } |
Most recent location is the last item in the array. |
|
How do you turn off power-saving mode while monitoring location changes? |
lm = new CLLocationManager { DesiredAccuracy = 1000 }; lm.PausesLocationUpdatesAutomatically = false; |
|
In iOS8 and beyond, location permissions are split into two types ofauthorization, one of which must be requested by the app. How do you request "in-use" permission? |
Only available on iOS 8+, so check the version the user is running first. if(UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { locationManager.RequestWhenInUseAuthorization(); } |
|
Always permission allows an app to receive notifications even if the app is moved to the background. How do you request "always" permission? |
if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { locationManager.RequestWhenAlwaysAuthorization(); } |
|
Maps iOS NSLocationWhenInUseUsageDescription specifies the message to display the first time your application calls RequestWhenInUseAuthorization. |
True |
|
iOS Maps -NSLocationAlwaysUsageDescription Specifies the message to display thefirst time your application callsRequestAlwaysAuthorization |
True |
|
Add the NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription to the info.plist on the "source" tab. |
True |
|
How do you monitor authorization change for iOS maps location? |
locationManager.AuthorizationChanged += (sender, e) => { if (e.Status != CLAuthorizationStatus.Denied) { // Location permissions allowed } }; |
|
In iOS maps, how do you show the users location? |
map.ShowsUserLocation = true; |
|
On iOS maps, CenterCoordinate defines the center of the map in lat/long coordinates. |
True |
|
Altitude defines how far away from the ground the camera is in meters. |
True |
|
Pitch defines the 3D angle of the camera with respect to the ground 0°indicates looking straight down; can slide two fingers to adjust pitchinteractively on real devices |
True |
|
Heading changes the compassdirection – which way is "up" on themap. It is expressed in degrees where zero(default) corresponds to true North |
True |
|
How to change the map centercoordinate, altitude, pitch, and heading in code? |
map.Camera.CenterCoordinate = locMgr.Location; map.Camera.Altitude = 1000.0; map.Camera.Pitch = 45.0f; map.Camera.Heading = 180.0; |
|
In iOS maps, how do you show a specific region? |
double distanceInMeters = 2000;MKCoordinateRegion region = MKCoordinateRegion.FromDistance( new CLLocationCoordinate2D(42.3, -71.0589), distanceInMeters, distanceInMeters); map.SetRegion(region, true) // animate to the new region |
|
In iOS maps, how do you detect if the region changes? |
map.RegionChanged +=delegate (object sender, MKMapViewChangeEventArgs e) { if (map.Camera.Altitude > 100) { map.Camera.Altitude = 99; } }; |
|
How do you add an annotation to iOS maps? |
var ptAnnotation = new MKPointAnnotation { Title = "Magilla’s Banana Store", Subtitle = "Best Bananas in town!", Coordinate = new CLLocationCoordinate2D (42.5, -71.0) }; map.AddAnnotation(ptAnnotation); |
|
How to remove an annotation on iOS maps? |
map.RemoveAnnotation(selectedAnnotation); map.RemoveAnnotations (map.Annotations); |
|
How to adjust the iOS maps viewport to show all annotations? |
map.ShowAnnotations(map.Annotations, true); True is for animating the movement. |
|
Bridge pattern is when you code to an interface and provide the implementation somewhere else. Basically like using DI. |
True |
|
Factory pattern - Dependencies can be located through factories which are responsiblefor creating the abstractions |
True |
|
One way to use a factory pattern is to have a service store a delegate that points to the implementation. |
True |
|
Pros and cons of factory |
Pro: Hides the implementation Easy to use and understand Can decide implementation at runtime and return specific version based on environment. CONS: Requires a separate factory for each abstraction (maint issue) Client must take dependency against factory Missing dependencies are not known until runtime. |
|
Service Locator pattern uses a container that maps abstractions(interfaces) to concrete, registered types – client then uses locator to finddependencies. Service locator is a singleton. |
True |
|
With a service locator, you register implementations for the abstractions in startup code. |
True |
|
To use the service locator, you ask the service locator for an instance of a service. |
var alert = ServiceLocator.Instance.Resolve(); |
|
Examples of Service locators are: Common Service Locator Most Mvvm libraries Xamarin.Forms DependencyService |
True |
|
Service locator pros and cons |
Pro: Easyto understand Clients can JIT-request services Can be used with any client CONS: Clients must all have access to the locator Harder to identify dependencies in code Missing dependencies harder to detect |
|
IoC containers create types and automatically supply the dependencies. |
True |
|
DI Container pros and cons |
Pros: Created client only needs real dependencies, no container references needed Easy to identify dependencies used since they are passed to constructor or properties Missing dependencies found earlier than SL CONS: Involves a bit of magic. A little harder to understand. Often requires some form of reflection, could be a performance hit. Clients can't request dependencies once they've been created/initialized. |
|
Service Locator is where ___________. a) Services are found and set into properties on the client b) Client request specific abstraction through a shared locator c) Client creates service directly d) You use Accio summoning charm to create the service. |
b |
|
Garbage collection is mapped on top of the platform memory management. On iOS there are 2 choices, prefer sgen over default. |
True |
|
If you are making an async call and you don't care what thread it returns to (eg you don't need to do anything on the UI thread immediately when it returns) use ConfigureAwait(false) on the call. It will result in a performance increase. |
var stuff = await client.doStuff().ConfigureAwait(false); |
|
When the garbage collector runs, it pauses your app. |
True |
|
Garbage collector kicks in when you request to allocate memory and there is not enough available. |
True |
|
Garbage collector compacts the heap in addition to freeing up objects. |
True |
|
Sgen has 3 heaps. Nursery, Major, and large (> 8k) objects. |
True |
|
Freeing up objects in nursery is cheap. |
True |
|
To prevent references from keeping object in memory, use weak references when you have a parent/child relationship (parent is a property on the child object). Set things like UIViews to null or manually call dispose on them. |
True |
|
Image caching: Use weak references because UIView uses an unmanaged resource so the garbage collector doesn't know how much memory it's using. Also manually dispose of image view objects. |
True |
|
Java bindings: - 2 options. JNI or a bindings library. JNI is quicker to get going but tedious to code and verbose. |
True |
|
You can create bindings for jar and aar files. |
True |
|
When binding Android jar files, you can choose to embed the jar into your binding library or have it separate aka "Input Jar". |
True |
|
Xamarin supports calling WCF with BasicHttpBinding and supports SSL. |
True |
|
xamarin.social supports App.net Flickr |
True |
|
Xamarin.Mobile is a library that exposes a single set of APIs for accessing common mobile device functionality across iOS, Android and Windows platforms. |
True |
|
To run code on the UI thread, use: InvokeOnMainThread ( () => { // manipulate UI controls }); |
True |