[Xamarin Blog] Build Your Own Selfies App with Xamarin.Forms and Azure

PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
edited June 2015 in Xamarin.Forms

Sending selfies to all your friends has never been easier thanks to Moments: a Snapchat clone built with Xamarin.Forms and Microsoft Azure. Best of all, Moments is also open-source and freely available under the MIT license, so building your own Snapchat clone based on Moments is easy. Follow the instructions here to get started building your own Snapchat clone.

Posts

  • JooAlmeida.9370JooAlmeida.9370 PTMember

    Amazing.. I wanted to know how we could do a custom camera render .. Thanks to your code now I can get some hints!

    Thanks a lot.

  • OussamaAlRifaiOussamaAlRifai AEMember

    Hi guys,

    I tried to download it from Google Play, but it is not available in my country (United Arab Emirates).
    Can you make it available please.

  • KarloMedalloKarloMedallo USMember

    Hi,

    Just wondering what's the main reason why there's no WP app if you were using Xamarin Forms?

    Thanks,

    Karlo

  • TimoKeller.9444TimoKeller.9444 DEMember ✭✭

    @KarloMedallo I thought the same. Very disappointed.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @JooAlmeida.2533: Thanks! I think Moments is great for seeing how to do lots of things with Xamarin.Forms, especially custom renderers (including everything from small controls to large pages).

    @OussamaAlRifai: I'll work on making that happen. In the meantime, the repo shows how to build your own (including the server component), so that might be a cool thing to check out. :)

    @KarloMedallo @OussamaAlRifai: Moments for Windows Phone is certainly in the plan. Because Xamarin.Forms allowed me to share ~88% of code on Android and iOS, Windows Phone would certainly see similar numbers. On a per-platform basis, there are a few custom renderers, like the PageRenderer to display the live camera feed, that have to be written, which have not been yet. Once those renderers have been written, I'll add Moments for Windows Phone to the repository.

  • Woody4618Woody4618 USMember

    Omg this is so awesome :) Thank you @pierce.boggan!

  • Woody4618Woody4618 USMember

    Just one question. If the client does the queries for the tables without checking in the server, isn't that a problem with security? I think you could just build your own client, get a token and then query all the moments from others, right?

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Thanks for the feedback! You probably could, but you would still need access to the actual keys of the Azure Mobile Service in order to do this. If you have suggestions on a better way to do this, I'm all ears. I think it's also important to keep in mind it's just a sample, so it shouldn't be taken as gospel. :)

  • Woody4618Woody4618 USMember

    Maybe i did not 100% undestand yet how the MobileServiceClient works. Maybe it is save to do it like this because its all SSL, but i would never trust a client. :) Im still pretty new to azure and xamarin. In my project i put more logic in the backend. So in the backend table controller "get" one can for example check for the RecipientUserId. But im using C# in the backend and google auth so its a little bit different. I will try out your code, thanks again for sharing, really cool.

  • TristanJTristanJ AUMember

    Woody4618 You handle this through adapting the server-side logic. E.g. on an insert call, you could check a custom 'user permissions' table to see whether the user has permissions to insert a given item. Same goes for select, update, delete, etc. I'm thinking about writing a blog post about this whole topic.

  • BrettMorrisonBrettMorrison USMember, University
    edited June 2015

    @pierce.boggan - great job with Moments. You did an excellent job incorporating Azure mobile services. A reference example! Really would love to see a Windows Phone version.

    @Woody4618 - Yes, it's safe to send the API token via SSL, and that in combination with user permissions mentioned by @TristanJ and in the original post - there's no security issue.

    p.s. I just submitted a PR for some minor updates.

  • SangramRathSangramRath USMember

    I am new to some stuff here and hence have a question, what is the preferred API version when trying to build and run it from Visual Studio 2013 (current I get an unknown exception and moments app crashes in the emulator). I have API 21.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Amazing, thanks all! I'm working on making some improvements to Moments, including updating some of the cloud logic and incorporating some feedback from you guys. If you ever have any improvements and want to submit a PR, feel free (thanks @BrettMorrison). :)

    @SangramRath: You should be able to build on any Android API level that is API 16 or greater. Moments doesn't work in an emulator for Android or simulator for iOS because it uses the camera, which is not generally available in those. I recommend testing on a device. :)

  • zahikramerzahikramer ILMember ✭✭✭

    hi @pierce.boggan
    great work!

    but, why i can't install the android app in Israel?
    google play says it is not legal on my country...
    ??

  • erichugheserichughes CAMember

    Is there a tutorial using Azure Services with a regular Xamarin app ?

  • CraigDunnCraigDunn USXamarin Team Xamurai

    @eric.8739 see the Xamarin Developer Center on the Azure portal

    http://azure.microsoft.com/en-us/develop/mobile/xamarin/

    There are examples for Xamarin.iOS and Xamarin.Android (which we also link from our website).

  • RianMostertRianMostert GBMember
    edited August 2015

    I'm curious as to how much it costs to maintain the Moments app. What services does the Moments app make use of and on average how much does it cost monthly?

  • TomMillerTomMiller USMember

    Great project--the camera implementation is exactly what I have been looking for in terms of guidance! Any idea when the iOS version will be available on the App Store?

  • iManchaiMancha ZAMember

    Hi Pierce

    Thanks for making this open source :wink:

    I am experiencing an error on the 2 files:

    Android Solution
    MainActivity.cs line 27
    UserDialogs.Init(() => (Activity)Forms.Context);
    Cannot convert 'lambda expression' to non-delegate type 'android.app.activity'

    iOS Solution
    Appdelegate.cs line 22
    UserDialogs.Init();
    'Acr.UserDialogs.UserDialogs' does not contain a definition for 'Init'

    I haven't made any changes to the code, just updated the packages and added my Azure keys to Keys.cs.

    Any ideas, what the issue could be? Thanks in advance

  • DavidDancyDavidDancy AUMember ✭✭✭✭

    @MarcoDeFreitas I just went to the source of the Acr.UserDialogs project here.

    It seems that @AlanRitchie has updated the Android side of the project to fix the problem.

    You may be able to download a new NuGet already. If not, it will probably be available shortly.

  • iManchaiMancha ZAMember

    @DavidDancy Thank you, I was able to update the package.

    Therefore the android side of the project is working correctly.

    @AlanRitchie More or less, when can the iOS update be expected?

    Thanks and Regards

  • AllanRitchie-oldAllanRitchie-old CAInsider ✭✭✭

    Wrong allan ritchie. You don't need an update for iOS. There is no longer any Init method for iOS. You have two options 1) don't update to 4.x, 2) remove the call.

  • Richard_EdwardsRichard_Edwards CAMember ✭✭

    @pierce.boggan Thanks for the great sample. I've been following along with the Podcast too. Good work!

    I would really love to see a UITest project added to this solution so we could all learn how to better test and to refactor the Azure calls to better allow testing.

  • @pierce.boggan this is awesome, exactly what I was looking for. It seems that it's been a while but are you still planning on bringing it to windows phone?

  • @pierce.boggan, thanks for sharing your code, I'm using your camera implementation on iPad, but the orientation and preview layer are showing weird, could you tell me how to fix this?

    Thanks.

  • RaphaelChiorlinRanieriRaphaelChiorlinRanieri BRMember ✭✭✭
    edited April 2016

    @pierce.boggan @PierceBoggan When using the front camera in Android I realized that the image was a little bit stretched out. I wonder if exists a way to solve this...

  • JesusGarza.9411JesusGarza.9411 MXMember ✭✭

    Hi @pierce.boggan, do you have any suggestion on how to respond to rotation?

  • OrthnellCashOrthnellCash USMember

    I'm a newbie to Azure so any help would be greatly appreciated.

    I've been trying to get the Moments project up and running but I'm having some trouble with the Azure set up. Azure appears to no longer have Mobile Services but instead now has Mobile App. I'm having trouble setting up the source control from step 5. Configuring the Service data backend. I don't see an option to Set Source Control like there was in Mobile Services. I do see an option to configure "Deployment Source" is that the same thing?

    The Mobile App code is supposed to be back up to GitHub and I run the git clone command to clone the repository to my desktop, correct?

    Thanks!

  • OrthnellCashOrthnellCash USMember

    Issue solved:
    I wasn't using a local git hub. Once I set up git hub locally I saw the needed options. This url was helpful https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/

  • JohnButlerJohnButler USMember ✭✭
    edited October 17

    Can anyone give me some tips for getting this to run now days with the New Azure Dashboard system?

    I have tried for 6 hours today and have yet to get it to run.
    But all the Azure information is out of date. And I thought I got it all relatively set up but I am stuck on two things (but much of it may be not correct)
    This whole part is no there, I created the tables with Easy Tables:
    "In the Azure Mobile Service go to DATA and then click CREATE at the bottom to add four tables (so repeat four times):
    Account with all the permissions set to "Anybody with the Application Key"
    User with "Anybody with the Application Key"
    Friendship with "Only Authenticated Users"
    Moment with "Only Authenticated Users""

    And then I cant create a container, so I don't know how to get the Container URL or Name. That has to do with this part of the set up:
    "Open the solution for Moments and navigate to Helpers/Keys.cs. Paste in relevant keys and information as seen below: Keys.cs These values come from:
    ApplicationURL - Azure Mobile Services DASHBOARD > MOBILE SERVICE URL
    ApplicationMobileService - Azure Mobile Services DASHBOARD > MOBILE SERVICE URL
    ApplicationKey - Azure Mobile Services DASHBOARD > MANAGE KEYS > APPLICATION KEY
    ContainerURL - Azure Storage CONTAINERS page NAME column
    ContainerName - Azure Storage CONTAINERS page URL column
    InsightsKey - Xamarin Insights configuration (using this is optional)"

Sign In or Register to comment.