In my company, we want to distribute an android app for only internal users.
We have one Google apps account (admin account) with our own company's domain name (xyz#sample.com).
We have other employee's email id with the company domain name(xyz#sample.com) and these are not under the Google apps.
Do we need the same Google apps account for all the employees under Google apps admin? As we need to make the app downloadable to all the internal employees too.
OR
Is it possible to make the android app downloadable with our own server's created email ids.
For Google APP account, do we need to pay Rs.150/employee/month?
EDIT:
I do not want to publish my android app on other play store where Google can not interfere.Is there any store? I have searched and found that there are many stores available but which is trustworthy.
All you need is your app available on the web for a common download. After in android, you need to download the apk and notify the user to update.
Below is the code I use to download the .apk and install it.
public void UpdateApk(){
String nameapk = "youapp.apk";
String urlDownload = "http://youserver/" + nameapk;
HttpURLConnection conn = (HttpURLConnection) new URL(urlDownload).openConnection();
conn.setDoInput(true);
conn.setConnectTimeout(20000);
conn.connect();
InputStream is = conn.getInputStream();
String PATH = Environment.getExternalStorageDirectory() + "/download/";
File file = new File(PATH);
file.mkdirs();
File outputFile = new File(file, nameapk);
FileOutputStream fos = new FileOutputStream(outputFile);
byte[] buffer = new byte[1024];
int len1 = 0;
while ((len1 = is.read(buffer)) != -1) {
fos.write(buffer, 0, len1);
}
fos.close();
is.close();
// till here, it works fine - .apk is download to
// sdcard in download file
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() + "/download/" + nameapk)), "application/vnd.android.package-archive");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
youcontext.startActivity(intent);
}
To check the version of the app, see this answer:
https://stackoverflow.com/a/14313280/185022
Related
I developed the ChatBot that integrates with SharePoint On Premise. When I debug the ChatBot in emulator, it work. But When I debug on Web Emulator in Azure and Website Hosted in Company Website by using DirectLine, it did not work.
Does anyone know how to solve it?
Herewith my screenshot.
Left hand side is from Web Emulator, Right hand side is from local Bot Framework Emulator
Update with Source Code (09 December 2019)
XmlNamespaceManager xmlnspm = new XmlNamespaceManager(new NameTable());
Uri sharepointUrl = new Uri("https://mvponduty.sharepoint.com/sites/sg/daw/");
xmlnspm.AddNamespace("atom", "http://www.w3.org/2005/Atom");
xmlnspm.AddNamespace("d", "http://schemas.microsoft.com/ado/2007/08/dataservices");
xmlnspm.AddNamespace("m", "http://schemas.microsoft.com/ado/2007/08/dataservices/metadata");
NetworkCredential cred = new System.Net.NetworkCredential("engsooncheah#mvponduty.onmicrosoft.com", "Pa$$w0rd", "mvponduty.onmicrosoft.com");
HttpWebRequest listRequest = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + "_api/lists/getByTitle('" + "data#work" + "')/items?$filter=Keywords%20eq%20%27bloomberg%27");
listRequest.Method = "GET";
listRequest.Accept = "application/atom+xml";
listRequest.ContentType = "application/atom+xml;type=entry";
listRequest.Credentials = cred;
//LINE 136 start from below
HttpWebResponse listResponse = (HttpWebResponse)listRequest.GetResponse();
StreamReader listReader = new StreamReader(listResponse.GetResponseStream());
XmlDocument listXml = new XmlDocument();
listXml.LoadXml(listReader.ReadToEnd());
if (listResponse.StatusCode == HttpStatusCode.OK)
{
Console.WriteLine("Connected");
await turnContext.SendActivityAsync("Connected");
}
// Get and display all the document titles.
XmlElement root = listXml.DocumentElement;
XmlNodeList elemList = root.GetElementsByTagName("content");
XmlNodeList elemList_title = root.GetElementsByTagName("d:Title");
XmlNodeList elemList_desc = root.GetElementsByTagName("d:Description");
//for LINK
XmlNodeList elemList_Id = root.GetElementsByTagName("d:Id");
XmlNodeList elemList_Source = root.GetElementsByTagName("d:Sources");
XmlNodeList elemList_ContentTypeId = root.GetElementsByTagName("d:ContentTypeId");
var attachments = new List<Attachment>();
for (int i = 0; i < elemList.Count; i++)
{
string title = elemList_title[i].InnerText;
string desc = elemList_desc[i].InnerText;
string baseurllink = "https://mvponduty.sharepoint.com/sites/sg/daw/Lists/data/DispForm.aspx?ID=";
string LINK = baseurllink + elemList_Id[i].InnerText + "&Source=" + elemList_Source[i].InnerText + "&ContentTypeId=" + elemList_ContentTypeId[i].InnerText;
//// Hero Card
var heroCard = new HeroCard(
title: title.ToString(),
text: desc.ToString(),
buttons: new CardAction[]
{
new CardAction(ActionTypes.OpenUrl,"LINK",value:LINK)
}
).ToAttachment();
attachments.Add(heroCard);
}
var reply = MessageFactory.Carousel(attachments);
await turnContext.SendActivityAsync(reply);
Update 17 December 2019
I had try using Embedded and Direct Line. But the Error still same.
The Bot is not hosted in SharePoint.
Update 06 January 2020
Its did not work in Azure Bot Services
Based on your description, you can fetch data from it locally. This means your code and logic are all right.
I noticed that your sharePoint URL is : https://mvponduty.sharepoint.com/sites/sg/daw/ and I tried to access it, and also tried to access your whole request URL : https://mvponduty.sharepoint.com/sites/sg/daw/_api/lists/getByTitle('data#work')/items?$filter=Keywords eq 'bloomberg' the response of the two are all 404.
And you said this is an on-prem site , so could you pls have a check that if this site can be reached from a public network?
I assume when you test your code locally, you can access this site as you are in your internal network which will be able to access the on-prem site. However, when you publish your code to Azure, it is not in your internal work anymore: it is in public network so that can't access your on-prem sharePoint site which caused this error.
As we know, bot code is hosted on Azure app service, if this error is caused by the above reason, maybe Azure App Service Hybrid Connections feature will be helpful in this scenario.
ChatBot seems to be working fine? it's sending and receiving messages. There's some code you have that is behaving differently when run locally versus hosted. There's Xml, is it a file or generated? You need check that it's following the same logic and using same data as when it is run locally. Maybe if you paste some of the (non confidential) code where it crashes, we can have more ideas how to help
When you publish your bot, there will be an option as below :
Select Edit App Service Settings. Add only the following details, nothing else :
MicrosoftAppId : <xxxxx>
MicrosoftAppPassword : <xxxxx>
Click Apply, Ok.
Make sure you remove the Microsoft App Id and Microsoft App Password from appsettings.json, so that it works in bot emulator as well.
Now Publish the bot. It will work at both places.
Hope this is helpful.
We have developed an Xamarin.Forms application. We provide option to export file to other apps to explore it. Exported mobi format file to Kindle in Google Pixel device, it couldn't upload in Kindle but this process works in other Android devices. We have used PackageManager.QueryIntentActivities process to list the installed app for export process. Please provide valiable suggestion for this.
Code Snippet:
var mobileFileName = Path.Combine(path, m_documentName);
var shareIntentsLists = new List<Intent>();
Intent sendIntent = new Intent();
sendIntent.SetAction(Intent.ActionSend);
sendIntent.SetType("application/pdf");
sendIntent.SetPackage("com.google.android.apps.docs");
sendIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.Parse("file://" + mobileFileName));
Intent chooserIntent = new Intent();
chooserIntent = Intent.CreateChooser(sendIntent, "Share with");
chooserIntent.PutExtra(Intent.ExtraStream, Android.Net.Uri.Parse(mobileFileName));
if (shareIntentsLists.Count > 0)
{
chooserIntent.PutExtra(Intent.ExtraInitialIntents, shareIntentsLists.ToArray());
}
chooserIntent.SetFlags(ActivityFlags.ClearTop);
chooserIntent.SetFlags(ActivityFlags.NewTask);
context.StartActivity(chooserIntent);
Regards,
Cheran
I am trying to upload videos to YouTube but somehow it's not working in Xamarin.Forms (Portable) project. Is there any way to upload the Videos in YouTube through Xamarin.Forms (Portable)
var initializer = new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = Constants.API.Google.ClientID,
ClientSecret = Constants.API.Google.ClientSecret
},
Scopes = new[] { YouTubeService.Scope.Youtube }
};
var flow = new AuthorizationCodeFlow(initializer);
TokenResponse token = flow.LoadTokenAsync("user", CancellationToken.None).Result;
but every time I am getting null in TokenResponse token, I am not sure what should I pass in place of user in flow.LoadTokenAsync("user", CancellationToken.None)
Thank You.
As I had feared the Google .Net client library does not currently support Xamarin. Please see issue: Unable to Google.Apis.Auth.PlatformServices in Xamarin.Forms
It's because GoogleWebAuthorizationBroker requires several classes from Google.Apis.Auth.PlatformServices, and Google.Apis.Auth.PlatformServices is not compatible with Xamarin.
We have app using oauth 1.0 in old marketplace. We are in process of migrating to oauth 2.0 for new marketplace. We are using UpgradeableApp API to do migration for existing domains. I am following steps specified here : https://developers.google.com/apps-marketplace/v1migratev2
As mentioned in the prerequisites in the above link: The scopes for the new and old apps must be compatible. But our new app has some additional scopes. Is there any way to grant access to these additional scopes while doing migration.
Only domain's admin or users can approve additional scopes.
Domain's admin receives an email notification after upgrade.
In your oauth2.0 app you can detect if all scopes have been approved or not. If not, you can show the user appropriate message to contact domain admin to get scopes approved.
For this we should have same scope in both old as well as on new listing. I am also facing the same problem of migrating the old users to new one. Kindly check the below code how I am migrating from old to new Users but every time I am getting 401 UnAuthorized, May I know what I am missing for this.
String url = String.Format("https://www.googleapis.com/appsmarket/v2/upgradableApp/{0}/{1}/{2}", oldAppId, chromeListing, domain);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "PUT";
request.ContentType = "application/json";
request.Accept = "application/json";
request.ProtocolVersion = HttpVersion.Version11;
request.Credentials = CredentialCache.DefaultCredentials;
request.Headers.Add("Authorization", "OAuth");
Hashtable postObj = new Hashtable();
postObj["Consumer Key"] = oldClientId;
postObj["Consumer Key Secret"] = oldSecret;
String s1 = new JavaScriptSerializer().Serialize(postObj);
var bs = Encoding.UTF8.GetBytes(s1);
using (Stream reqStream = request.GetRequestStream())
{
reqStream.Write(bs, 0, bs.Length);
}
using (WebResponse response = request.GetResponse())
{
using (var sr = new StreamReader(response.GetResponseStream()))
{
result = sr.ReadToEnd();
sr.Close();
}
}
I am trying to upload photos form Windows phone (mango) to facebook with BackgroundTransferRequest object. This is because I want to upload photos even if the app is not running.
I am using facebook C# SDK to get access token etc and which works great but to upload using this, we need to keep the APP active.
I can use fiddler and create a Post request with access token and upload the image to facebook to a album.
https://graph.facebook.com/178040612256938/Photos/?access_token=AAACEdEose0cBAA4p0Ozqj0H39RP2tGyxdq0LAxoADyBZCPgjgrXMwU93VAOVkulemC3ZC5lVZCTiJ3rYeFXtM67tYNEZBvPQmasbT9AvX
Now, here is my code that I took off of sample here - http://msdn.microsoft.com/en-us/library/hh202959(v=vs.92).aspx
I am not sure how to add headers that fiddler adds OR how to use this for uploading photos to FB. getting 400 as response. Currently the following code can upload photo to my WCF service.
also looked at - BackgroundTransferRequest WP7
IsolatedStorageFileExtensions.SavePicture(Path.Combine(TransfersFiles, picture.FileName), picture.Data);
string fbURL = #"https://graph.facebook.com/106216062727932/Photos/?access_token=AAACEdEose0cBAA4p0Ozqj0H39RP2tGyxdq0LAxoADyBZCPgjgrXMwU93VAOVkulemC3ZC5lVZCTiJ3rYeFXtM67tYNEZBvPQmasbT9AvD";
var transferRequest = new BackgroundTransferRequest(new Uri(fbURL, UriKind.Absolute));
if (!_wifiOnly)
{
transferRequest.TransferPreferences = TransferPreferences.AllowCellular;
}
if (!_externalPowerOnly)
{
transferRequest.TransferPreferences = TransferPreferences.AllowBattery;
}
if (!_wifiOnly && !_externalPowerOnly)
{
transferRequest.TransferPreferences = TransferPreferences.AllowCellularAndBattery;
}
//this is the place to upload to Facebook
transferRequest.Method = "POST";
//_OLD transferRequest.UploadLocation = new Uri(TransfersFiles + #"\" + picture.FileName, UriKind.Relative);
transferRequest.UploadLocation = new Uri(TransfersFiles + #"\" + picture.FileName, UriKind.Relative);
string boundary = DateTime.Now.Ticks.ToString("x", CultureInfo.InvariantCulture);
//---
transferRequest.TransferStatusChanged += OnTransferStatusChanged;
transferRequest.TransferProgressChanged += OnTransferProgressChanged;
BackgroundTransferService.Add(transferRequest);