Xamarin Forms: Share Picture on Instgram [closed] - xamarin.ios

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I am developing a Xamarin Forms application with Android and iOS solutions.
I am desperately searching for a full example to allow a user to share on Instagrama picture taken from my app.
Anyone can point to some good tutorial/example/github repo/etc. ?

You can't directly post to an Instagram API as that is private, but you can Share a photo, with the Instagram app, if the user has that installed on their phone. Which is what I think you are trying to achieve. I don't know of any repo or sample, hence will need to do a bit of work yourself on this.
To do this you can use the Instagram Uri Scheme. For iOS you will need to use the Document Interaction section, in Android, you start a new activity and pass the media through.
You will need to code these natively and use Dependency Injection, to pass it into your Xamarin Forms app. An example on how to start an Activity in Android is as such:
public Task<bool> LaunchApp(string uri)
{
bool result = false;
try
{
var aUri = Android.Net.Uri.Parse(uri.ToString());
var intent = new Intent(Intent.ActionView, aUri);
Xamarin.Forms.Forms.Context.StartActivity(intent);
result = true;
}
catch (ActivityNotFoundException)
{
result = false;
}
return Task.FromResult(result);
}
Modify Instagram's example to suit.

Related

Huawei Safety Detect checkURL API threat return empty list even when using malicious url for testing

Im trying to check if url is malicious in my app. But the output always return that the link is safe even when i put malicious link. Im developing the app using Android Studio and use both GMS and HMS library. Im running the app on my device which is Samsung and its working fine except for the problem i mention above. Help me please.
And one more thing, I've downloaded the appGallery on my phone and install hms core. But do i still need to convert gms library to hms library?
Thank you.
This is the response code.
#Override
public void onSuccess(UrlCheckResponse urlCheckResponse) {
List<UrlCheckThreat> list = urlCheckResponse.getUrlCheckResponse();
if (list.isEmpty()) {
// No threats found.
testRes.setText("No threats found.");
} else {
for (UrlCheckThreat threat : list){
int type = threat.getUrlCheckResult();
if(type == UrlCheckThreat.MALWARE){
//threat.getUrlCheckResult();
testRes.setText("Malware found!");
}
else {
if (type == UrlCheckThreat.PHISHING)
//threat.getUrlCheckResult();
testRes.setText("Phishing found!");
}
}
}
}
Could you please send me the link? That way I can do research. Please note: maybe the link is totally new so it may escape detection.
For your other question: "I've downloaded the AppGallery on my phone and install hms core. But do i still need to convert gms library to hms library.".
The answer is no, you don't need to convert anything. But note: you must integrate Huawei SDK when you try to use Huawei Kit features on your GMS phone or HMS phones.
Apparently, the API to check list of malicious URL took time to function. The response code was functioning well and can detect the malicious URL. Thank you for all the responses.

Has azure user ids changed their format?

Good evening ppl at Microsoft!
I have an Mobile App Service at Microsoft Azure Located at South Central US named CeneamApp.
My backend is configured in a way so that my user can access only the data they capture, by making use of stable user ids.
so I had followed Adrian Hall book to create an a user id (https://adrianhall.github.io/develop-mobile-apps-with-csharp-and-azure/chapter2/authorization/)with the following format sid:{identifier}as described here: (https://github.com/Azure/azure-mobile-apps-net-server/wiki/Understanding-User-Ids).
now all my userid had been changed and my user cant access their previous data capture by them, because somehow the provider or issuer or whatever is going on, doesnt let me retrieve a user id as described by the github project team wiki (in the previous link). so instead i receive a new userid but seem to be a random number:
I'm adding screenshot of the essential part of my code at my backend project which i debugged so i could understand whats going on and my dummy database where you can see an stable_id save on it and the new suppose stable_ids the next two rows.
Debugged code retrieving apparently a new userid from FACEBOOK could you confirm about this change? because I havent been able to understand this change.
Dummy Database with the lost userid and the new ones from other accounts database screenshot
if anyone has information about this odd behavior i would appreciate to enlight me, because this line of code:
principal.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;
used to give me a user id with this format: "sid:{identifier}", now the format is a the screenshot shows.
Same situation here. About to go live and suddenly this. Interesting that only one Mobile App based in the UK datacenter is affected. Other 2 apps which are in production and plus another Web App are still fine.
The full solution can only be provided by Azure team. But I have a workaround and and idea:
1. Workaround.
In the base controller I read and parse the token from the header. The sid is in the subject of the token. The code is simple:
string _userSid;
public string UserSid
{
get
{
if (_userSid == null)
{
KeyValuePair<string, IEnumerable<string>> auth_header = Request.Headers.FirstOrDefault(h => h.Key.Equals("x-zumo-auth", StringComparison.InvariantCultureIgnoreCase));
string token = auth_header.Value.FirstOrDefault();
if (!string.IsNullOrEmpty(token))
{
var jwtToken = new JwtSecurityToken(token);
if (jwtToken != null)
{
_userSid = jwtToken.Subject;
}
}
}
return _userSid;
}
}
I use it instead of getting this from ClaimPrinciple as per manual. I checked the Mobile App Server code does a very similar thing.
2. Idea.
Azure Mobile Apps have this parameter:
MobileAppsManagement_EXTENSION_VERSION it is recommended to set to latest. I think if we downgraded it to previous version it would work until Microsoft finds and solves the problem. The only issue is that I do not know and could not find the version number. May be someone knows and can post here?

How to make outgoing calls in c#

I am trying to make outgoing call from C#.net 4.0, with pre-recorded message.I have
hiro usb modem h50113
already in the system to detect caller id.
I tried googling and found out few links
1.OZEKI
2.TWILIO
3. TAPI
in OZEKI I need to get SIP account not sure where to get that, and I am guessing that would cost me.
Twilio seems to be cheap but not sure how to use as there are codes like :
using System;
using Twilio;
class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/user/account
string AccountSid = "AC8ca11aff9660bdf011958a5718df9633";
string AuthToken = "{{ auth_token }}";
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var options = new CallOptions();
options.Url = "http://demo.twilio.com/docs/voice.xml";
options.To = "+14155551212";
options.From = "+14158675309";
var call = twilio.InitiateOutboundCall(options);
Console.WriteLine(call.Sid);
}
}
Not sure where to write this code.
Also I think I can put use to usb-modem to make calls . So please advice what is the best possible way to achieve this and if possible in no cost.
Thanks
Twilio developer evangelist here.
If you are looking at making outgoing calls with Twilio, I suggest you follow this quick start guide on making calls in C#. It will take you through the basics.
For a more in depth look, I'd take a look through this tutorial on building a click to call system with C# ASP.NET MVC.
Let me know if that helps at all.
I am able to solve the issue . As I already had
hiro usb modem h50113
so i just used AT Command
ATDT (Phone number)
here is the code :
this.sp.WriteLine("ATDT 1234567890" + System.Environment.NewLine);
However , only it can ring , theirs no voice . Working on it as soon as I get it will post.
one can refer my old question for better understanding How to make caller id in c#.net

How to know if a page loaded via iframe is within sandbox? [duplicate]

This question already has answers here:
Detect if JavaScript is Executing In a Sandboxed Iframe?
(2 answers)
Closed 7 years ago.
I'm trying to detect if a page is loaded via a sandboxed iframe. Is this possible?
For example,we provide custom embeddable widgets and some people think they are being smart by sandboxing them in their iframe, but this breaks certain things.. such as window.top.location
Obviously, they could enable the features we need, but ideally, I should be able to just do something like:
"sandbox" in window.top
I have also tried doing
try {
// do something that would not work if within sandbox
} catch(e) {
}
But this doesn't work because it's a browser security error, and not related to javascript.
JSFiddle actually sandbox their iframes to prevent window.top.location navigation, so this would be a good example to show you.
If you look at this example here:
http://jsfiddle.net/mwsb8geL/show/
You can see the error when you press the Instant Book Online button.
A project sandblaster can help you detect if you running being sandboxed.
Inside the iframe where you are testing if it is sandbox, open up your script tag and paste the contents of https://raw.githubusercontent.com/JamesMGreene/sandblaster/master/dist/sandblaster.js. This is due to the security issue.
After this, its as simple as the following.
var result = sandblaster.detect();
if(result.sandboxed === true) {
//sandboxed
}
Here is a demo I made for another answer but shows that the solution works.

Deep-linking into Spotify app

I’m having trouble finding documentation on Stack Overflow and on the Spotify Developers site around Deep-linking into a Spotify app from an external resource (i.e. a webpage). Can you provide a sample URI that would be used for an app with the name “mymusicapp”?
Thanks!
A URI for your app would be:
spotify:app:mymusicapp
To deep link, just keep going:
spotify:app:mymusicapp:artist:Coldplay
If you do that, the ARGUMENTSCHANGED event will fire on the application object.
var sp = getSpotifyApi();
var models = sp.require('$api/models');
models.application.observe(models.EVENT.ARGUMENTSCHANGED, function() {
console.log(application.arguments);
});
For more information, see the Application class documentation.
Does this answer your question? http://www.spotify.com/se/blog/archives/2008/01/14/linking-to-spotify/
There is also the Web api which can be useful for finding the links: https://developer.spotify.com/technologies/web-api/

Resources