Xamarin Android App update - c#

I've been developing android apps on Xamarin for 3months now, but I am facing a problem to update the application when a new release is available.
The application is not published to any app store(as we use it internally), I know Play store can do automatic updating, but I need to look for an update on our server, I would prefer if all this can be done silently(in the background).
here is my current code, this copy's the app to the device:
intent.SetData(Android.Net.Uri.Parse(#"http://xxxxx/downloads/app.test-signed.apk"));
StartActivity(intent);
this installs the app onto the device:
intent.SetDataAndType(Android.Net.Uri.FromFile(new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory.Path +
"/app.test-signed.apk")), "application/vnd.android.package-archive");
StartActivity(intent);
but this way it asks to install (and I don't think this is the correct way), and doesn't start my app automatically after it was installed. And I am not sure how to wait until the app finished downloading before it tries to install.

I had a similar issue with an app which only gets used internally in my company. I didn't want the app going to the big wide world as the general public wouldn't have any use for it.
So, what we've done is publish the final product as 'Alpha release' in Google Play. You set up a Google Group with a set of e-mail addresses of devices that can access it, and once the app has been downloaded it will update just like any other app from Google Play.
There's an option to 'Promote' it to Beta or Production, but given that it never gets promoted it is never searchable on Google Play.

As Corey Ogburn mentionned, the silent install won't be possible without root.
Altough an answer was already posted to your question on Xamarin's forum.
On another note, following Dave's idea, you could set a Private Channel on Google Play. As you already know, Google Play offers easy automatic update, and with a Private Channel, you will be able to give special authorization on who has access to your app.
Read more on Private Channel here.

Related

Evernote notes overwritten when updated externally

I'm building an app that updates Evernote notes via the Windows C# API. I've noticed an issue where a note that is updated by my app in between sync's in the Windows desktop app (for example) is overwritten.
This also happens when a note is updated in between sync's via another app (e.g. iPhone). To explain this further I've outlined the steps to reproduce the problem using the Windows and iPhone apps.
Please note that in order to repro this there must be a delay in between syncs in the Windows app. Within the app the sync interval can be changed in Tools > Options > Synchronization:
Create note with a reminder in the Windows app
Manually sync Evernote (Windows app)
Sync this note to another device, say the iPhone app
Add a tag to the note & sync (iPhone app)
Complete the reminder in the Windows app
Manually sync Evernote (Windows app)
If the above steps "work", once the Windows app is sync'd the reminder will be active (i.e. not complete) and the tag will be added.
I understand that this sort of scenario is unlikely to happen in a real usage scenario of Evernote, however as I am updating notes regularly via the API the chances of it happening or much more likely.
The ideal solution would be to update specific fields instead of the whole note, however I could see any way to do this.
Anyone have any ideas?
Thanks
When you call NoteStore#updateNote, try to set guid and only attributes you want to update and leave the rest unset.

Azure mobile app offline sync causing a MobileServicePushFailedException -> CancelledByAuthenticationError

As part of a UWP app we're developing at work, we have an Azure mobile app (C#, .NET backend) connected to the client which is supposed to sync up with offline SQLite storage and place CRUD operation requests into a queue so they can be processed by a worker role.
Trouble is, for some reason when we attempt to call PushAsync/PullAsync on the sync context and messages table respectively, it throws a MobileServicePushFailedException. When monitoring this in locals, the PushResult status is "CancelledByAuthenticationError" but this happens even after successfully logging in via one of the providers, and we haven't yet set the table to require authentication anyway so this shouldn't be causing any problems.
Interestingly enough, when this was a mobile SERVICE as opposed to a mobile app running in a Windows 8.1 project instead of a UWP, it worked fine, because the MobileServiceClient constructor in that version of the Nuget package takes the application key as one of its arguments. Unfortunately, we're developing a UWP, so it needed to be migrated and thus we can't use the same constructor any more.
Has anyone come across this before, or does anyone have any idea where we might be able to find further information on this? We haven't been able to find any other concrete references online besides another SO post that was asking about a similar but different issue, and a few other posts that either have no answers or are working with different languages/backends.

how do you beta a windows phone 8.1 app

How beta windows phone 8.1 app. Might sound like a newbie question but bear with me. I have written and app like quite a few others but this is the first app where I want to support wp8.1 and wp10. The app side loaded on to a wp8.1 or wp10 device works fine as expected.
If put into the Windows store as beta with the necessary emails will install on wp10 devices but refuses to install on wp8.1 devices no matter what.
If I put into the store as normal it fails testing with an ungraceful shutdown that I cannot replicate.
I can't install beta to get the crash dumps to find out what's going on. So now am completely stuck.
Any help or advice would be much appreciated.
If you want to publish a beta version to a specific group of people, then you'll need to select the following option :
Hide this app and make it available only to the people you specify
below, who can download this app on Windows Phone 8.x devices. A
promotional code may be used to download this app on Windows 10
devices.
Only the people whose email addresses (associated with their Microsoft accounts) that you enter in the box can download your app by using the direct link to its listing. If you want W10 beta testers, then you'll need in addition to generate promotional code and send each promoted link to your W10 beta testers. Check this link to learn more about beta publishing on Windows Store.
If you failed to install beta version on WP8.1 devices, I can see two reasons:
Email addresses defined in the publisher portal do not match with the one activated on the WP8.1 devices
You tried to install the WP8.1 app immediately after defining the list of Email addresses in the publisher portal. In fact you'll to wait couple of hours before beta version becomes available on devices
Thanks for your answers. But after a long protracted process I finally got through to Microsoft. (If you do't have paid for MSDN support is damn near impossible to talk to anyone) Turns out there was a problem with my dev account. safe to say the issue is now fixed and apps are downloading/installing again

Send and Receive Messages between Android App and Winform application

Looked for a long time and didn't find anything that showed this, so I apologize in advance I missed something.
I have an android app running on KitKat (Android 4.4.2) and a Winforms application running Windows 7. I need to send messages between the two of them.
Clearly GCM works to get the message to the Android device. I have code that sends from Winforms to the Android Device using GCM. I cannot find a way to have the Android App send anything BACK though. Is it possible to have a Winforms app RECEIVE a GCM Message? Do I have to use Azure? (All examples there seem to focus on the Windows App store and Windows 8.1 neither one of which can be a solution in this case due to client restraints.)
I'm putting this here in case anyone stumbles across it and has a similar question. This is not really an answer. Still hoping someone comes on here and shows that I am wrong. But after 26 days, no one has even offered a suggestion, so I'm guessing not.
There is no way that I have seen that allows for this the way I had hoped. Windows 7 doesn't have this built in to it (AFAIK). Windows 10 should have it built in, but Windows 7 pre-dates the huge shift to the cloud, and didn't have it in the design. If I were working with something like Xamarin -- which is a cross-platform tool, this might be possible. But there is no concept in Windows 7 for receiving messages from the Cloud.
In order to accomplish this, there would have to be some sort of server added to the mix that could take messages and pass them along via a REST API. This is beyond the scope of what I wanted to code.
The solution I found, and that works for me, is to use Microsofts API that wraps a REST service. This allows for communication to OneDrive, for example. That is what I am using as my intermediary REST server.
Microsoft LIVE SDK
This has a pretty good sample list of Android examples, and can be used for what I need. The good thing is the Upstream is just a simple call, and I don't need to have the Android device poll anything (which kills the battery). The laptop will need to poll OneDrive, but its plugged in so there is no battery life concern.
One thing to be aware of, though, is that Microsoft sort of hints that they don't want a bunch of traffic headed to OneDrive. This is from the overview doc:
Throttling
OneDrive has limits in place to make sure that individuals and apps do
not adversely affect the experience of other users. When an activity
exceeds OneDrive's limits, API requests will be rejected for a period
of time. OneDrive may also return a Retry-After header with the number
of seconds your app should wait before sending more requests.
Although, I have never seen what those limits actually are, so YMMV.

Sending Push Notification to Windows 8 Metro style app in C#

I've downloaded the Microsoft sample code for registering your app to push notifications to. Sample
I have sent the channel URI to myself in an email, and I believe I have all the relevant information to actually send a push. But I've never dealt with the server-side sending of a push notification.
The sample app should just output whatever I send.
I can't find any pre-existing apps to help me. I just want to be able to see some information in the sample app window. From there I should be able to figure out what to send in future, headers, etc.
Is there a sample app, where I just put in the Channel Uri, token, SID and secret, and it'll send something like "Hello world" to my app? Preferably with source, so I can take it apart and see how it's being done.
Take a look at the tutorial for the Windows Azure Mobile Services Push Notification:
http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-push-dotnet/
I will second the recommendation for Windows Azure Push Notifications, with another blog overview (using JavaScript) here
If you do want to get under the hood a bit more the reference pointed to above - http://watwindows8.codeplex.com/ - does work with RTM; however, the setup is coded to work only with the Release Preview.
If you'd like to set it up you can do the following:
In Setup\CheckW8.ps1 change the build number in text from 8400 to 9200
$os = Get-WmiObject Win32_OperatingSystem;
if ($os.BuildNumber.Equals("9200")) {
exit 1;
}
...
Then in Setup\DependencyChecker\WATWindows8.depi, delete the three <dependency> sections entirely. The assumption here is that you already have Visual Studio 2012 RTM, the Azure Tools for 2012 RTM, and NuGet is up to date.
When you run the setup as instructed by the Toolkit, it should now work. You'll get an empty list of dependencies, but that's fine since you've already installed them manually.
The C# Push Notification sample code should be fine on a recompile (you'll get an error about the package name, but that's expected since it's part of the configuration you need to do).
For the JavaScript version, you'll have to patch the script references to the RC version in default.html, remove the old "Window Library for JavaScript" from the references and add the new one.

Categories

Resources